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 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>
  VirtualHost XXX.XXX.XXX.XXX:80>
  ServerAdmin webmaster@localhost
  ServerName sub.domain.com

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

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

  <Location />
    Order allow,deny
    Allow from all
  </Location>

</VirtualHost>

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 http://sub.domain.com/custom-errors/customerror.html
  Alias /customerrors /var/www/custom-errors/

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


  <Location />
    Order allow,deny
    Allow from all
  </Location>

</VirtualHost>

<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/++vh++http:sub.domain.com:80/++$1 [P,L]
  RewriteLog /var/log/apache2/domain-dev-rewrite-2.log
  RewriteLogLevel 0

  <Location />
    Order allow,deny
    Allow from all
  </Location>

</VirtualHost>
share|improve this question
add comment

1 Answer

up vote 1 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/++vh++http:sub.domain.com:80/++/custom-errors/customerror.html to localhost:6080

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

Adding:

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
add comment

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.