Question & Answer
Question
How do I create customized error pages?
Answer
In a typical IBM WebSphere Application Server environment, there are many pieces of IBM software involved, such as IBM HTTP Server, Web server plug-in, and WebSphere Application Server. When a request comes in from a Web browser, there might be an error at any of those layers of software. By default, the error page returned to the browser is generic in appearance. However, it is possible to create customized error pages and configure the IBM software to send the customized error pages instead.
The purpose of this technote is to act as a single point of reference with links to other documentation regarding how to create customized error pages in various IBM software products.
Plug-in |
The Web server plug-in determines if the request should be handled by WebSphere Application Server, or should be handled by IBM HTTP Server.
IBM HTTP Server |
If the request is handled by IBM HTTP Server, and an error occurs, use the ErrorDocument directive in the IBM HTTP Server config (httpd.conf) to specify a customized error page for that specific error, as described here, ErrorDocument Directive.
For example, the following tells IBM HTTP Server to send the custom404.html page if there is a 404 error in IBM HTTP Server:
ErrorDocument 404 /errors/custom404.html |
Web application running in WebSphere Application Server |
If the request is handled by a Web application running in WebSphere Application Server, and an error occurs, use the error-page option in web.xml (or web_merged.xml if it exists) to specify a customized error page. For more details, see the Information Center topic Web.xml.
For example, the following tells the Web application to send error404.html page if there is a 404 error in the application.
<error-page> <error-code>404</error-code> <location>/error404.html</location> </error-page> |
WebSphere Application Server proxy server |
If the error originates from the WebSphere Application Server Web container, as a result of a WebSphere Application Server problem or perhaps the Web application is not active, then it might be necessary to use the WebSphere Application Server proxy server in conjunction with a special error page application. For more details, see this page in the Information Center, Overview of the custom error page policy.
For example, take a look at the sample error page application that comes with WebSphere Application Server located here:
<WAS_INSTALL_ROOT>/installableApps/HttpErrorHandler.ear |
Was this topic helpful?
Document Information
Modified date:
15 June 2018
UID
swg21393358