Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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'm trying to set up a reverse proxy with Apache, and for the most part it is working well with ProxyPass. I would like to exclude one of the directories which I understand I can do with the ! indicator, documented here:

So I have:

ProxyPass /examples !
ProxyPass / http://localhost:3000/

That works okay if I go to a file in /examples which exists, but if I hit an address which results in a 404 error, the request gets proxied rather than just the 404 being returned.

I would rather the 404 is returned. I couldn't see anything about this in the documentation - does anyone know how it can be done? Many thanks!

This is with Apache v2.4.6.

share|improve this question
up vote 0 down vote accepted

Depending on your Apache setup a default error document has been defined outside of the /examples location excluded from your ProxyPass. My RHEL 6 has the default:

 Alias /error/ "/var/www/error/"
 ErrorDocument 404 /error/HTTP_NOT_FOUND.html.var

Which will result in any 404 message being redirect to /error/HTTP_NOT_FOUND.html.[en | es | de | fr ] depending and the accept language settings of the browser generating the 404 error.

IN your case that means a request for /examples/no-such-file will still be redirected to http://localhost:3000/.

Second to you may want to investigate in the meaning of the ProxyPassReverse directive you omitted from your sample config.

share|improve this answer
Ah! Yes I see the logic problem there. Complicated a little by the fact that i was some 404's to go through the proxy, that little nugget of information was really useful - thanks! Thanks also for the pointer about ProxyPassReverse . – user3041361 Jan 22 '14 at 16:49

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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