Overview of the custom error page policy
The custom error page policy is a feature that enables the proxy server to use an application to generate an HTTP error response. With this capability, the administrator can return a polished error page when the proxy server generates an error, or when a content server returns an unsuccessful response.
The following action describes scenarios for how the error page policy is used when it is configured:
- Internal error
- The client sends the following request to the proxy server: GET /house/rooms/kitchen.jpg HTTP/1.1.
- The proxy server generates an internal error because no servers map to the request (HTTP 404 - File not found).
- The error policy is configured to handle HTTP 404 responses, so it sends a request to the error page application to retrieve error content to send to the client. The request URI and HTTP response code are included as query parameters in the request to the error page application. If the configured error page application URI is /ErrorPageApp/ErrorPage, then the request URI to the error page application is: /ErrorPageApp/ErrorPage?responseCode=404&uri=/house/rooms/kitchen.jpg. The query parameters "responseCode" and "uri" are sent to the error page application by default.
- The proxy server returns the response code and the content that the error page application returned. The error page application can also be set up to return the response code that is passed in the responseCode query parameter.
- Remote error
- The client sends the following request to the proxy server: GET /house/rooms/kitchen.jpg HTTP/1.1
- The proxy server forwards the request to the homeserver.companyx.com content server.
- The homeserver.companyx.com content server is unable to locate the /house/rooms/kitchen.jpg file and sends an HTTP 404 response (File not found) to the proxy server.
- The error policy is configured to handle HTTP 404 responses, so it sends a request to the error page application to retrieve error content to send to the client. The request URI and HTTP response code are included as query parameters in the request to the error page application. If the configured error page application URI is /ErrorPageApp/ErrorPage, then the request URI to the error page application is: /ErrorPageApp/ErrorPage?responseCode=404&uri=/house/rooms/kitchen.jpg. The query parameters "responseCode" and "uri" are sent to the error page application by default.
- The proxy server returns the response code and the content that the error page application returned. The error page application can also be set up to return the response code that is passed in the responseCode query parameter.
A sample error application is available in the <WAS_INSTALL_ROOT>/installableApps/HttpErrorHandler.ear file.
When you configure the on demand router to use a custom error handling application, enter the following tag in the <Head> section of the html page:
<Base href="http://<Server>/<ErrorPageAppContextRoot>/" />
For <Server>, use a value specific to the topology. In most cases <Server> is the on demand router. We can get this information from the servlet API.
For <ErrorPageAppConextRoot> , enter the context root for the error handling application.
This configuration helps you prevent issues when displaying the error information. gotcha