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.
Best Answer
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:
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 tohttp://localhost:3000/
.Second to you may want to investigate in the meaning of the
ProxyPassReverse
directive you omitted from your sample config.