Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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: http://httpd.apache.org/docs/current/mod/mod_proxy.html#proxypassreverse

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

1 Answer 1

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 at 16:49

Your Answer

 
discard

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.