Errors originating in the application router show the HTTP status code of the error. It is possible to display a custom error page using the errorPage property.
The property is an array of objects, each object can have the following properties:
Application Router: errorPage Properties
|
Property |
Type |
Mandatory |
Description |
|---|---|---|---|
|
|
Number/Array |
Yes |
HTTP status code. |
|
|
String |
Yes |
File path relative to the working directory of the application router. |
|
|
String |
Yes |
URL path relative to the HTML application root folder |
Here is an example:
{ "errorPage" : [ {"status": [400,401,402], "file": "./custom-err-40x.html"}, {"status": 501, "file": "./http_resources/custom-err-501.html"} {"status": 403, "path": "/forbidden.html"} ] }
In this code example, errors with status code “400”, “401” and “402” will show the content of ./custom-err-4xx.html. Errors with the status code “501” will display the content of ./http_resources/custom-err-501.html For errors with status code 403, the user is redirected to "/forbidden.html".
To avoid errors when redirecting to an error page that is stored in the HTML5 Application Repository service, define a route without authentication to the error page. For example:
{ "source": "^/forbidden.html$", "service": "html5-apps-repo-rt", "authenticationType": "none" }
The contents of the
errorPageconfiguration section have no effect on errors that are not generated by the application router.