cancel
Showing results for 
Search instead for 
Did you mean: 

customize error 503 page for apecific application with apache

Former Member
0 Kudos

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>

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

we have solved this issue by directing the "ApplicationStoppedFile" to a "smart" html page.

and in the html page we are redirecting to an error page based on the url in the client browser.

this seems to work fine.

Ivan-Mirisola
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Alon,

I am glad that you found a solution for you problem.

For the future, take a look into SAP Note 795699 - Customizing default error messages for HTTP.

Anyway, I am not aware of Apache integration with SAP WebAS. But when you use SAP Web Dispatcher you have an option for customizing the HTTP error pages via parameter 'icm/HTTP/error_templ_path'. As far as I remember the Apache mod_proxy does not now how to do load balance between SAP WebAS smartly. It will either do it by count or traffic information. Whereas SAP Webdispatcher will gather information about acctual load of the Application Servers involved in the LB group and sends the requests accordngly.

Perhaps you can use Webdispatcher toguether with Apache Server and error pages from Webdispatcher would be displayed on the client's browser.

I think it is worth a try.

Best regards,

Ivan

Former Member
0 Kudos

can some please suggest what is wrong with the apache coning or even suggest another way to achieve the same goal ?