On any exceptions, by default Spring Boot routes to /error
, which generates an error HTML page:
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Wed Oct 31 16:01:01 CET 2018
There was an unexpected error (type=Not Found, status=404)
Question: how can I instead show a blank page by default for a certain endpoint only?
There is a property server.error.whitelabel.enabled=false
, but that disables the error handling entirely, so that the webservers default error page is shown (e.g. on Tomcat a 404 error page).
That's not what I want. I'd just like to show a blank plain page. Or so to say: an empty response body. But how?
Because, for development and testing the "Whitelabel Error Page" is fine. But in production I'd like to hide any exception details entirely.