46

You exclude paths from mod_proxy with an exclamation mark (!) before your full ProxyPass statement, which your sample is missing - It would look something like ProxyPass /path balancer://backend-cluster1. Therefore, to exclude a path, add: ProxyPass /my/excluded/path ! before ProxyPass /my balancer://backend-cluster1


36

it looks like proxy_http_module isn't getting loaded, make sure you have following inside of your httpd.conf: LoadModule proxy_http_module modules/mod_proxy_http.so


33

I finally fixed this problem after testing several configuration parameters. I tested the solution twice, removing all previous changes. Only one parameter was needed for me to fix it. For the latest versions of httpd and mod_proxy_fcgi you can simply add timeout= to the end of the ProxyPassMatch line, e.g.: ProxyPassMatch ^/(.+\.php.*)$ fcgi://127.0.0.1:...


15

We have a similar setup and are using this (of course you need to load before mod_proxy, mod_ssl and mod_proy_http): ProxyRequests Off # SSLProxyEngine On # only required if the proxied service would be HTTPS as well # Meaning if we would reverse proxy https://thirdparty.com/app/ # Thanks @Piskvor for the ...


15

facepalm It turns out that I was missing a trailing slash on my ProxyPass directive: ProxyPass "/site/" "balancer://cms" should have been: ProxyPass "/site/" "balancer://cms/" (Note the trailing slash before the close-quote.) That literally fixed everything. I'm happy to delete this question and answer if folks want to close it as "simple ...


14

I used dumpio. I put the following in /etc/httpd/conf.d/dumpio.conf: LoadModule dumpio_module modules/mod_dumpio.so DumpIOInput On DumpIOOutput On DumpIOLogLevel debug LogLevel debug An often forgotten piece is setting the LogLevel to debug. Without it, you won't actually see any DumpIO output. The log output is written to the error log for the virtual ...


13

Under Apache 2.2, no - the ProxyPreserveHost directive is only valid in the server config or virtual host contexts; you'd need the different ProxyPass statements to be in different virtual hosts. In Apache 2.4, yes - the directory context has been added for the directive, so you can now do something such as: <Location /to-varnish/> ...


13

You use ProxyPassMatch instead: ProxyPassMatch ^/media http://localhost:9002/(.*) ProxyPassReverse ^/media http://localhost:9002/(.*) Find further details in the Apache online documentation.


12

I found this solution, I don't know if is the best way, but works for me. Remove the line: ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.2:9126/<path>/$1 Add this in your directive: <Directory /var/www/yoursiste.com> Options -Indexes +FollowSymLinks -ExecCGI +MultiViews AllowOverride All <IfModule mod_proxy_fcgi.c> ...


12

You're going to want to do something like this on Server A: NameVirtualHost * <VirtualHost *> ServerName owncloud.mydomain.com ProxyRequests Off <Proxy *> Order deny,allow Allow from all </Proxy> ProxyPass / http://192.168.0.10:80/ ProxyPassReverse / http://192.168.0.10:80/ <Location /> ...


11

If the server actually handling a request does a redirect to a different URL on that server, the ProxyPassReverse directive rewrites the URL in terms of the reverse proxy server. For example, as noted in the Apache documentation, if: http://reverseproxy.com/mirror/foo/bar is sent (reverse proxied) to http://backend.example.com/bar for handling, but at ...


10

It seems there's a difference between stopping and then starting apache and doing a apachectl graceful restarting (i.e. actually stopping and starting as opposed to apachectl restart) as found at this site: This is a bit of a guess, and probably wrong, but does stopping and starting the server rather than restarting (they're different, restarting (...


10

I wanted to point out that although this answer works great for older versions, it breaks under recent versions of Apache 2.4 with error code AH00526. ProxyPass and ProxyPassMatch or <Proxy> and <ProxyMatch> cannot be used together within the same worker name. This used to function just fine, so don't know if that was changed by design or if it's ...


10

This is how I got it to work. As well as the changes as per my comment to my original question, I needed to exclude .js and .css from the rule that added a trailing slash. <VirtualHost *:80> ServerAdmin admin@localhost ServerName mydomain.com ServerAlias www.mydomain.com ErrorLog ${APACHE_LOG_DIR}/error.log LogLevel warn ...


9

Here is the solution for your problem: To turn on this boolean you simple have to use this line (root permissions) setsebool -P httpd_can_network_connect on or sudo setsebool -P httpd_can_network_connect on Hope that helps. Reference see here: https://wiki.centos.org/TipsAndTricks/SelinuxBooleans


9

To get things to work, I also needed to load mod_proxy_wstunnel Once I did, this ruleset got things working: (in the VirtualHost of the domain that receives and proxies the websocket request) <IfModule mod_proxy.c> ProxyPass "/_ws_/" "ws://127.0.0.1:8080/" ProxyPassReverse "/_ws_/" "ws://127.0.0.1:8080/" </IfModule> The browser can ...


7

Despite the Apache mod_headers doc saying that it does not matter where the Header line goes, it apparently does. The only way I could get the header added was to put it in the same location scope as the proxy pass. I initially had the proxy pass defined in the VirtualHost tag directly, but had to move it into the LocationMatch sub tag. <LocationMatch ...


6

For completeness: if it's an option, it's a good idea to terminate SSL at Apache, rather than having Tomcat handle it as well. Providing Tomcat is only accessible from Apache this is simpler and no less secure. In this setup, Apache would proxy HTTP and HTTPS to http://myserver:8080/: NameVirtualHost *:443 <VirtualHost *:80> ProxyPass /tomcat/ ...


6

I have Apache 2.4.6, but the patch to fix it is provided in Apache >= 2.4.8. The key here is to start your output immediately so that Apache (mod_proxy_fcgi) thinks the connection is active. For example, I am using PHP and the DB query for my AJAX call takes > 30 seconds. Because I know that the overall response will be "Content-Type: application/json", I ...


6

The include directive would let you structure your proxy configuration like this: proxy.conf: <VirtualHost *:80> Include app1_proxy.conf Include app2_proxy.conf </VirtualHost> app1_proxy.conf: ProxyPass /app1 http://localhost:8101/app1 ProxyPassReverse /app1 http://localhost:8101/app1 app2_proxy.conf: ProxyPass /app2 http://...


6

In my case, I needed proxy_ajp module. a2enmod proxy proxy_http proxy_ajp


6

anders' answer got me 95% of the way there. The basic scenario: We have a server on newapp.example.com Port 8080 is running both HTTP and WebSockets The URL that responds to WebSockets requests is /api/socket/ We're reverse-proxying this application as http://apps.example.com/newapp/ This is how to configure WebSockets and HTTP reverse-proxying for the ...


5

Take note of the Apache documentation here: http://httpd.apache.org/docs/2.2/mod/mod_proxy_http.html It seems there is a race condition in mod_proxy_http, but it can be avoided by including: SetEnv proxy-initial-not-pooled 1 Which prevents Apache using a pooled connection if this is an initial request. The document does note that this setting will give a ...


5

RequestHeader can insert values of environment variables into header values, and SetEnvIf can set environment variables based on request header values, so the following configuration should achieve what you need: SetEnvIf X-Forwarded-For (.*) saved_x_forwarded_for=$1 RequestHeader set X-Custom-Forwarded-For "%{saved_x_forwarded_for}e" You should use set ...


5

Looks like there are some issue described in this Apache Bugzilla. The solution was adding these line in httpd.conf inside <Proxy> section SetEnv force-proxy-request-1.0 1 SetEnv proxy-nokeepalive 1 Update After deploying above solution, I faced another problem as the client was sending the request using HTTP/1.1 and the proxy was forced to use HTTP/...


5

In addition to Alastair McCormack answer: If you use <Location>, you need to put the exception below instead of before: <Location /my/> ProxyPass balancer://backend-cluster1 </Location> <Location /my/excluded/path/> ProxyPass ! </Location>


5

I found answer from: mod_proxy - Apache HTTP Server and I test it (It works!(TM)): <Proxy *> Order deny,allow Deny from all Allow from 10.52.208.221 Allow from 10.52.208.223 </Proxy>


5

This is easily done with mod_proxy: ProxyPass /rep1/ibm http://reportingserver1.example.com/ibm ProxyPassReverse /rep1/ibm http://reportingserver1.example.com/ibm ProxyPass /rep2/ibm http://reportingserver2.example.com/ibm ProxyPassReverse /rep2/ibm http://reportingserver2.example.com/ibm There is more information at the apache documentation site for ...


5

Check if PHP-FPM is running. The error log says that apache can't make connection to 127.0.0.1:9000. Make it running and (maybe) the error will go. Also check if PHP-FPM running via socket. Maybe it's running but not listening in TCP/IP stack.


5

You're missing the reverse mapping which is precisely useful to Apache for redirection URLs rewriting. In 99% of cases, the forward and reverse mappings are the same. Add this : ProxyPassReverse / http://localhost:8080/ And reload Apache.


Only top voted, non community-wiki answers of a minimum length are eligible