41

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


16

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

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


11

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


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


11

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


10

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


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


8

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>


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


7

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


7

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


7

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


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

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


6

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.


6

From what I can tell ProxyPass isn't meant to be used inside of a block - you have it in a <Location> block. It needs to be out of that block, and you need to turn SSLProxyEngine on as well: SSLProxyEngine On ProxyPass /admin https://localhost:8083/ ProxyPassReverse /admin https://localhost:8083/


5

You can also append proxy:trace5 to your existing LogLevel directive If you have this LogLevel error Change it to this LogLevel error proxy:trace5 Be sure to change that back to normal after use. This will create huge log files fast.


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

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

First you need to stop apache2.4 from decoding slashes in your path (%2F). To do so set AllowEncodedSlashes NoDecode And you need to prevent the escaping of 'dangerous' characters like '#'. With mod_rewrite that would be the [NE] flag, with mod_proxy set nocanon This results in: <VirtualHost *:80> ServerName rabbit.example.com ...


5

Apache httpd added HTTP/2 proxy support from 2.4.21 but suggest you run latest (2.4.27 at time of writing) as this module is still changing quite a bit at the moment. Tomcat has just added HTTP/2 support in Tomcat 9: https://readlearncode.com/configure-tomcat-9-for-http2/ So in theory this should all fit together nicely if you're willing to upgrade to ...


4

Redirect any requests for plain www.domain.com to www.domain.com/index.html and then add an proxy exclude before forwarding everything else to Tomcat: RewriteRule ^/$ /index.html ProxyPass /index.html ! ProxyPass / http://localhost:8080/ ProxyPassReverse / http://localhost:8080/


4

This is a known issue with mod_proxy, since 2011. The ttl needs to be shorter than the application's keepalive, so that apache is always first to send a FIN. Another difficulty is it's not defined at what point the connection will actually be closed. ttl - Time to live for inactive connections and associated connection pool entries, in seconds. Once ...


4

With the ProxyPass (link) directive, you define a proxy in the first place. The <proxy ...> (link) section can contain processing directives for the proxied content. This is something you can learn yourself by just reading the docs, hence the downvotes.


4

OK. I can explain this. Apache mod_proxy_balancer doesn't have its own independent healthcheck mechanism. The state of Balancer Members (workers) is determined based on outcome of actual forwarded users requests. Sequence is as follows: Apache httpd sends request to worker Worker doesn't respond, or responds with HTTP status which triggers failover,and ...


4

960010 is a phase 1 rule. Phase 1 runs before <location> directives are processed. So you need to write a rule with ModSecurity doing the location filtering for you rather than Apache. Something like this: SecRule REQUEST_URI "^/myapp/mymethod.do" "phase:1,id:12345,nolog,ctl:ruleRemoveById=960010" This basically creates another rule which only ...


4

mod_proxy canonicalise URLs passed to the backend. If you want suppress this behavior use nocanon keyword and this passes the URL path "raw" to the backend. Eg: ProxyPass / http://127.0.0.1:8081/ nocanon


4

Somewhere in your Apache configuration, you must have matching Listen directives for each port you want to listen to: Listen 3000 Listen 3010 It appears that you already have one, but not the other.


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