1.1 KiB
1.1 KiB
Custom error pages
You can configure SVR.JS to serve custom error pages by adding .<errorcode> (SVR.JS 3.0.0 or newer) or <errorcode>.html pages. For the 404 error, you can specify it by changing the page404 property in config.json. From SVR.JS 3.8.0 onwards, you can use errorPages property in config.json to specify path to each custom error page.
When designing custom error pages, you can make use of the following placeholders or templates:
- {errorMessage} - Displays the error code along with its short description.
- {errorDesc} - Displays a longer description of the server error.
- {stack} - Displays the error stack, which is equivalent to the Error.stack property in JavaScript.
- {path} - Shows the path of the page that caused the error.
- {server} - Displays the server version string along with the hostname. For example, "SVR.JS/3.9.6 (Linux; Node.JS/v12.22.12) on 127.0.0.1:8080" or simply "SVR.JS on svrjs.org".
- {contact} - Displays the contact information of the server administrator, which can be set using the serverAdministratorEmail property in config.json.