I have dockerized a SpringBoot application.
When the application is running in a container, it does not return an error message in an error response (500).
e.g.
{
"timestamp": 1704495987474,
"status": 500,
"error": "Internal Server Error",
"path": "/api/conferences/1/check_roles"
}
When the application is run on localhost, with "mvn spring-boot:run", it does return a message in an error response (500).
e.g.
{
"timestamp": 1704496938120,
"status": 500,
"error": "Internal Server Error",
"trace": "(Long message)",
"message": "Authentication failed!",
"path": "/api/conferences/1/check_roles"
}
Why could this be? I need this because of an error checking in FE, so that I could display the right information for the user.
I tried looking in the nginx config, that is running as a FE docker container with Angular application, but could not find anything.
I tried implementing a custom ExceptionHandler in Spring, but it did not help either.
I looked at custom error handling, per point 7., in this link: https://www.baeldung.com/exception-handling-for-rest-with-spring#bd-spring-boot
And I found this:
server.error.include-message: since version 2.3, Spring Boot hides the message field in the response to avoid leaking sensitive information; we can use this property with an always value to enable it
It looks like this in my .yml config file:
server:
error:
include-message: always