Friday, June 13, 2014

Overriding Spring Boot HTTP status codes for health pages

One thing I found a little baffling when I started using spring boot was that the health pages returned 200 regardless of your 'Status'. So 'DOWN' would return a 200 with the actual information in a JSON payload. This means any monitoring system needs to parse the JSON rather than just know based on the HTTP status code.

Finally for Spring Boot 1.1 you can override this! For example if you want DOWN to be a 500, then add the following to your application properties file.

endpoints.health.mapping[DOWN]=INTERNAL_SERVER_ERROR

1 comment:

Arthur Morgan said...

Cleaning day used to be my least favorite day of the week, but not anymore! Thanks to this incredible cleaning service, I can now enjoy my weekends without worrying about chores. They're reliable, thorough, and they always exceed my expectations. Don't hesitate to give them a "https://www.kdcleaningny.com/"!