Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
35

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


30

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:...


25

Add retry=0 to your ProxyPass lines: ProxyPass / http://127.0.0.1:4711/ retry=0 From the mod_proxy documentation: Connection pool worker retry timeout in seconds. If the connection pool worker to the backend server is in the error state, Apache will not forward any requests to that server until the timeout expires. This enables to shut down the backend ...


24

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


14

You can avoid proxying for a specific location by telling mod_proxy to ignore it with a ! for a destination: ProxyPass /lib ! ProxyPass / http://127.0.0.1:5012/ ProxyPassReverse / http://127.0.0.1:5012/


14

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 ...


13

mod_proxy marks an unresponsive backend as down when it seems to be down; if no backends are available then it responds with a 503. By default, a down backend will be marked as such for 60 seconds; until that time passes, it won't retry the connection (and replies with an error message to any connecting clients). To have it retry immediately, add retry=0 ...


11

I solved my issue : If I do: sestatus -b | grep httpd I can see httpd_can_network_connect is off The solution is to type: togglesebool httpd_can_network_connect


11

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> ...


11

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/> ...


11

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

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 ...


10

You can avoid proxying for a specific directory by specifying a ! in place of the proxy target. Since it acts on a directory, move error.html into a subdirectory (we'll say errors), and: <VirtualHost *:80> ServerName servername DocumentRoot /somepath/ ProxyPass /errors ! ProxyPass / http://localhost:8080/someapp/ ProxyPassReverse / http://...


10

Yes very much possible. For example: <VirtualHost *:80> ServerName yourdomain.tld ServerAlias www.yourdomain.tld *.yourdomain.tld DocumentRoot /path/to/your/website/document/root ProxyPass /images ! ProxyPass /assets ! ProxyPass / http://127.0.0.1:8080/ ProxyPassReverse / http://127.0.0.1:8080/ <Proxy http://localhost:8080/*&...


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 (...


9

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 ...


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 ...


8

I went ahead and researched this one out. After reading multiple tutorials and the Apache doc, I was able to piece together something substantial, which seems to work well. Using the list above, I put together a set of rules/declaratives which seem to handle compression with the mainstream content types: <Location /> # Insert filter SetOutputFilter ...


8

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 ...


8

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 ...


8

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


7

Try %{BALANCER_WORKER_ROUTE}e. There's a few other variables available for checking on the request routing, too; see here.


7

The code for the forum has the /forum/ path hardcoded in the HTML that it's sending to the client, or otherwise defined somewhere in its configuration. If you can change it to /, do so; otherwise, you can work around it in your Apache config: <VirtualHost *:80> ServerName forum.mydomain.com ProxyPass /forum/ http://127.0.0.1:8080/forum/ ...


6

It actually means the opposite to what you suggested: the person in Taiwan accessed (or attempted to access) eBay via your server. It means that someone was using your machine as an open proxy. Most likely they were probing to see if you had an open proxy configured. The fact that the message says "attempted" would suggest that they didn't succeed, but a ...


6

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


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://...


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

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/ ...


5

A RewriteCond line only affects the next RewriteRule that is processed. It does nothing on its own. Since there is no RewriteRule following it in the snippet of your config you have given us, my best guess is that the RewriteCond is doing nothing. A quick change that should block anything not sending the correct Host: header: RewriteCond %{HTTP_HOST} !^...


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