6

I'm running Apache 2.2 on FreeBSD. As of late I've been looking at Cherokee + uWSGI for some Django/Python.

I want to keep Apache 2.2 at the front (port 80 replies) and proxy connections to my Cherokee server running at the same machine.

My problem is that I've got some legacy stuff for a few dir locations on my URL.

I want / to go to my Cherokee (reverse proxy) but keep Apache for /dir1/ and /dir2/.

I got the reverse proxy working fine with mod_proxy.

ProxyRequests            Off
<Location />
    ProxyPass                http://127.0.0.1:8080/
    ProxyPassReverse         http://127.0.0.1:8080/
</Location>

Cherokee is running at port 8080 on localhost.

The problem is that I can't figure out how to turn off the reverse proxy for /dir1/ and /dir2/ so that Apache process the incoming requests to the dirs.

Is it possible to add Location directives for /dir1/ and /dir2/ to tell Apache not to reverse proxy the dirs?

5

From reading ProxyPass's doc, You should do something like that :

ProxyPass                /dir1/ !
ProxyPass                /dir2/ !
ProxyPass                /      http://127.0.0.1:8080/
ProxyPassReverse         /      http://127.0.0.1:8080/
  • Thank you very much, exactly what I was looking for. The final solution was to move the ProxyPass + ProxyPassReverse outside <Location> and move /dir1/ and /dir2/ ! before the ProxyPass in order to catch it before the / ProxyPass – Daniel Johansson Feb 15 '10 at 16:38
  • I've edited the answer to reflect that. – mat Feb 15 '10 at 16:39
  • This is extremely useful as LocationMatch directives will not work with ProxyPass correctly. – Lucas Holt Apr 18 '13 at 17:50
  • 1
    If you get "Service unavailable" and are using Apache to route requests to Tomcat or JBoss, you may also need the following "JkUnMount /dir1/ ajp13" - this will stop this routing happening. BTW, this works even if you place it in your httpd.conf instead of the mod_jk.conf file (handy for debugging) – Philip Murphy Dec 22 '16 at 11:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.