You can customize the error page that CommandBox servers return. You can have a setting for each status code including a default error page to be used if no other setting applies.
Create an errorPages
object inside the web
object in your server.json
where each key is the status code integer or the word default
and the value is a relative (to the web root) path to be loaded for that status code.
This is what you server.json
might look like:
You can set error pages via the server set
command like this:
If your error page points to a CFM file, you can get access to the original path being accessed for 404s and the error that was thrown for 500s. To see all the request headers that are available, use the following snippet of code:
An example of getting the original missing path in a 404 would look like this: