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 running into various problems trying to add custom ErrorDocuments to my server.

I'm using proxy balancer to share the load between two instances of Zope and some simple rewrite rules to map my domain to the local zope instances. I'm pretty sure Zope isn't the problem, but have mentioned it to explain what the balancer redirects to.

I've tried a number of suggestions, but the 'closest' I can get is included below and results in the error:

"Firefox has detected that the server is redirecting the request for this address in a way that will never complete."

Other variations result in:

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

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

If I include a simple

ErrorDocument 503 Hello

It renders fine.

What am I doing wrong? I'm worried that it may be something to do with the balancer/rewrite getting 'in the way' of the custom errors? Or that my DocumentRoot is incorrectly set?

The rest of this configuration runs fine without the custom errors.

  VirtualHost XXX.XXX.XXX.XXX:80>
  ServerAdmin webmaster@localhost

  <Proxy balancer://domain_dev>
    BalancerMember http://XXX.XXX.XXX.XXX:81
    BalancerMember http://XXX.XXX.XXX.XXX:82

  RewriteEngine On
  RewriteRule ^(.*)$ balancer://domain_dev$1 [P,L]

  <Location />
    Order allow,deny
    Allow from all


Listen 81
Listen 82

<VirtualHost XXX.XXX.XXX.XXX:81>
  CustomLog /var/log/apache2/domain-dev-1.log combined
  ErrorLog  /var/log/apache2/domain-dev-error-1.log

  ErrorDocument 503
  Alias /customerrors /var/www/custom-errors/

  RewriteEngine On
  RewriteRule ^(.*)$ http://localhost:6080/++skin++SandboxSkin/site/$1 [P,L]
  RewriteLog /var/log/apache2/domain-dev-rewrite-1.log
  RewriteLogLevel 0

  <Location />
    Order allow,deny
    Allow from all


<VirtualHost XXX.XXX.XXX.XXX:82>
  CustomLog /var/log/apache2/domain-dev-2.log combined
  ErrorLog  /var/log/apache2/domain-dev-error-2.log

  RewriteEngine On
  RewriteRule ^(.*)$ http://localhost:6081/++skin++SandboxSkin/site/$1 [P,L]
  RewriteLog /var/log/apache2/domain-dev-rewrite-2.log
  RewriteLogLevel 0

  <Location />
    Order allow,deny
    Allow from all

share|improve this question
up vote 2 down vote accepted

Setting LogLevel Debug I found:

[Mon Sep 14 19:26:06 2009] [debug] proxy_util.c(2015): proxy: connected /++skin++SandboxSkin/site/ to localhost:6080

Which confirmed that the proxy was trying to serve the error from the offline servers location.


RewriteCond %{REQUEST_URI} !^/custom-errors/

Stopped the proxy rewriting any redirects with 'custom-errors' directories in the request.

After that, the following simplified ErrorDocument rule worked fine:

DocumentRoot "/var/www"
ErrorDocument 503 "/custom-errors/customerror.html"
share|improve this answer

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.