Skip to Content
0
Former Member
Aug 08, 2006 at 09:48 PM

customize error 503 page for apecific application with apache

662 Views

We would to show our own error page when a specific J2EE application is stopped for some reason (for example during a Deployment), we know there is an option to set the "ApplicationStoppedFile" in the "http provider" service in visual admin , but this option is not sufficient for us because we have several J2EE application running on the SAP J2EE server and we would like a different error page for each one of them.

Since we are using APACHE reverse proxy for each application we thought we can configure the apache to react to "error 503" you are getting when you try to access an application that is stopped.

According to SAP note 795699 –"The response code is preserved as 503 and is not changed to 200 (OK)".so it should be possible to set the apache to get a 503 response code from the J2EE server and display the right error page for this error code. Although we have configured the apache server to handle these errors it seems like it doesn’t recognized the "503 Service Unavailable- Application stopped" page as a 503 error page and it simply displays the usual SAP J2EE error page

here is the httpd conf file :

<VirtualHost 194.29.32.228:443>

ProxyRequests Off

proxyvia on

SSLEngine on

SSLProxyEngine on

DocumentRoot "/var/www/html"

ServerAdmin webmaster@checkpoint.com

ServerName ucnew.checkpoint.com

ErrorLog logs/ucnew.checkpoint.com-error_log

CustomLog logs/ucnew.checkpoint.com-access_log common

ProxyPreserveHost on

ProxyPass /usercenter https://sapwebdisp1.checkpoint.com:8502/usercenter

ProxyPassReverse /usercenter https://sapwebdisp1.checkpoint.com:8502/usercenter

SSLCertificateFile /etc/httpd/conf/ssl.crt/server1.crt

SSLCertificateKeyFile /etc/httpd/conf/ssl.key/server1.key

Alias /error/ "/var/www/error/"

<IfModule mod_negotiation.c>

<IfModule mod_include.c>

<Directory "/var/www/error">

AllowOverride None

Options IncludesNoExec

AddOutputFilter Includes html

AddHandler type-map var

Order allow,deny

Allow from all

LanguagePriority en es de fr

ForceLanguagePriority Prefer Fallback

</Directory>

ErrorDocument 400 /error/HTTP_BAD_REQUEST.html.var

ErrorDocument 401 /error/HTTP_UNAUTHORIZED.html.var

ErrorDocument 403 /error/HTTP_FORBIDDEN.html.var

ErrorDocument 404 /error/HTTP_NOT_FOUND.html.var

ErrorDocument 405 /error/HTTP_METHOD_NOT_ALLOWED.html.var

ErrorDocument 408 /error/HTTP_REQUEST_TIME_OUT.html.var

ErrorDocument 410 /error/HTTP_GONE.html.var

ErrorDocument 411 /error/HTTP_LENGTH_REQUIRED.html.var

ErrorDocument 412 /error/HTTP_PRECONDITION_FAILED.html.var

ErrorDocument 413 /error/HTTP_REQUEST_ENTITY_TOO_LARGE.html.var

ErrorDocument 414 /error/HTTP_REQUEST_URI_TOO_LARGE.html.var

ErrorDocument 415 /error/HTTP_UNSUPPORTED_MEDIA_TYPE.html.var

ErrorDocument 500 /error/HTTP_INTERNAL_SERVER_ERROR.html.var

ErrorDocument 501 /error/HTTP_NOT_IMPLEMENTED.html.var

ErrorDocument 502 /error/HTTP_BAD_GATEWAY.html.var

ErrorDocument 503 /error/HTTP_SERVICE_UNAVAILABLE.html.var

ErrorDocument 506 /error/HTTP_VARIANT_ALSO_VARIES.html.var

</IfModule>

</IfModule>

</VirtualHost>