Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to set a Apache reverse proxy so that requests get proxyed to another application running on 8080. However, I want some directories to be directly served rather than forwarded to proxy. What I want is:

http://localhost/ -> http:// localhost:8080/myapp
http:// localhost/images -> /var/www/html/images
http:// localhost/anything-else -> http:// localhost:8080/myapp/anyhthing-else

My current httpd.conf is

ProxyRequests Off
ProxyTimeout 600
ProxyPreserveHost On
ProxyPass / http:// localhost:8080/
ProxyPassReverse / http:// localhost:8080/
RewriteEngine On
RewriteRule ^/(.*) http:// localhost:8080/VirtualHostBase/http/%{SERVER_NAME}:80/myapp/VirtualHostRoot/$1 [L,P]

What configuration should I do to make the local path exception to work?

Thank you, Tania

share|improve this question

marked as duplicate by Jenny D, mdpc, MichelZ, Scott Pack, Andrew Apr 3 '14 at 6:22

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

this is not a duplicate of the question on mod_rewrite. its about mod_proxy.. – Garet Claborn Mar 25 '15 at 23:38

I found the solution.

To make an exclusion for /myapp, I need to add

ProxyPass /myapp !

as the first ProxyPass directive as exclusions should come before the general rule.

I also need to add

RewriteCond !^/myapp/(.*)

before RewriteRule to exclude it from RewriteRule

share|improve this answer