-
Notifications
You must be signed in to change notification settings - Fork 41.2k
Spring Boot 1.4.0: HTTP Status Issue #6548
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
That's a strange one. The problem's unlikely to be Spring (Boot or MVC) itself as we just call the servlet container to set the response status. Can you please provide some more details? I'm particularly interested in which container you're using. A sample that reproduces the problem would be ideal. |
I've reproduced this. The details about a global exception handler are something of a red herring. The behaviour applies to all HTTP responses using Tomcat 8.5.4. If I downgrade to 8.0.36 the responses are as expected. Having educated myself a bit, this behaviour is legal in terms of the HTTP spec where the reason phrase for the status is defined as being optional:
The HTTP/2 removes the reason phrase entirely so I suspect this is a side-effect of Tomcat 8.5's support for HTTP/2 that's also affecting its support for HTTP 1.1. In short, the change in behaviour is due to a change in Tomcat 8.5 and is legal in terms of the HTTP spec so I don't think there's anything that can/should be done in Spring Boot. @markt-asf FYI, I thought you may be interested in this. |
It came more from RFC 7230 than HTTP/2. In addition to the ABNF Andy quotes above, there is also the following text:
Reason phrases added some overhead, especially if custom ones were used since Tomcat had to make them safe. Given the ABNF and the above text, we opted to drop the reason phrase entirely. To quote the comment in the relevant part of the Tomcat "Clients should ignore it (RFC 7230) and it just wastes bytes." |
Bug
I have a
GlobalExceptionHandler
that catches exceptions and returns a HTTP Error codes.This works correctly and responds with a
404
. But the HTTP response looks like this:But should return:
The
Not Found
part is missing. This is the same for other errors. e.g.500 - Internal Server Error
The text was updated successfully, but these errors were encountered: