Search⌘ K

Custom Error Pages

Explore how to create custom error pages using Thymeleaf in Spring Boot. Understand how to add individual or range-based error templates and configure properties to include exception details for clearer error messages.

The default error page

Spring Boot shows the below Whitelabel error page by default, which is quite ugly. This is likely intentional to encourage users to add their own. It should look like this:

Adding error templates

If we add a Thymeleaf template at templates/error with the error code as page name, then ...