2

I'm trying to setup a custom error page (reverse proxy is apache)

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.**

But the error page isn't loaded if I stop my tomcat server for example (503 error)

And I receive the message above not my .HTML message

my config looks like this:

<VirtualHost *:443>
ServerAdmin XXX
ServerName  XXX


# Possible values: debug, info, notice, warn, error, crit, alert, emerg.
LogLevel warn
ErrorLog XXX
CustomLog XXX
DocumentRoot /var/www/html/
ErrorDocument 503 /503.html

<Directory />
    AllowOverride None
    Require all granted
</Directory>

ProxyPreserveHost On
<Location />
    AddDefaultCharset Off
    Require all granted
    ProxyPass ajp://XXX:XXX/ disablereuse=on
</Location>

If I changed the line ErrorDocument to foo instead of /503.html I see foo so it looks like the .HTML isn't loaded by the config? Is there someone who can help me with it?

1 Answers1

1

Location / it's served by tomcat. This means that /503.html will be proxied via AJP to be processed by tomcat. If tomcat is down also /503.html page will be unavailable. You need to add another Location stanza for error documents.

Mircea Vutcovici
  • 16,706
  • 4
  • 52
  • 80
  • Thanks for the answer, so you get something like this? AddDefaultCharset Off Require all granted ProxyPass ajp://XXX:XXX/ disablereuse=on AddDefaultCharset Off Require all granted ErrorDocument /var/www/html/error/503.html – Sander Böhm Mar 29 '21 at 14:56
  • Yes, but pay attention of the order of each `Location` section: https://httpd.apache.org/docs/2.4/mod/core.html#location – Mircea Vutcovici Mar 29 '21 at 15:36