I have an Apache 2.4 server on Windows Server 2008 R2 that I use as a reverse proxy. It has been working fine and serves about 15 virtual hosts. Whenever a host fails, I want to display a web page indicating that the server is down temporarily. I placed the custom error file in a folder in the htdocs folder called errors. I have the following directives in the httpd.conf file:

ErrorDocument 500 /errors/default.html
ErrorDocument 502 /errors/default.html
ErrorDocument 503 /errors/default.html
ErrorDocument 504 /errors/default.html
ErrorDocument 400 /errors/default.html
ErrorDocument 404 /errors/default.html
ErrorDocument 408 /errors/default.html

<Directory "C:/Program Files/Apache Software Foundation/Apache2.4/htdocs/errors"> 
Order deny,allow 
Allow from all 

I shut down one of the proxied servers to test the error page and I see the following:

Service Unavailable The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.

Additionally, a 503 Service Unavailable error was encountered while trying to use an ErrorDocument to handle the request.

If I use a text error message e.g "The server is currently off line" then I DO see that text displayed. If I reference an external web server to serve the page then I see the page served from that server. It is almost as if the Apache server is ONLY proxying requests and is unable to serve the local error pages.

I am guessing I need to add or change a virtual host entry to allow the Apache server to serve a local page (the error pages) but since the server is only referenced by IP in DNS I am not sure how to do that (it is using named hosts). I just assumed that the error pages would be properly served by Apache without additional configuration (beyond allowing the permissions on the folder with the error pages and referencing them in the ErrorDocument entries).

What did I miss? The setting up of custom error documents seemed simple but I can't serve them from the proxy itself.


Directly from Apache Docs

If you are using mod_proxy, you may wish to enable ProxyErrorOverride so that you can provide custom error messages on behalf of your Origin servers. If you don't enable ProxyErrorOverride, Apache httpd will not generate custom error documents for proxied content.

Also by using ErrorDocument 503 /errors/default.html apache believes it is on the origin server, then issues its own error saying it can not find it as well.

  • Thanks for the information. I did have the ProxyErrorOverride set to on originally but I still had the same issue so I went back to the configuration file and notice that the argument was "on" rather than "On" and saw this in the Apache docs: "Directives in the configuration files are case-insensitive, but arguments to directives are often case sensitive" So I made the change to use "On" and I'll restart the proxy when I get a chance and see if that will fix the issue. – Pete Helgren May 29 '13 at 15:30
  • That took care of it! It must be a case sensitive argument – Pete Helgren May 29 '13 at 16:28

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.