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
1.4.0.M3: SseEmitter, Jetty, CORS: Wrong charset in Content-Type header #6230
Comments
Thanks for the sample that reproduces the problem. The
|
Isn't that related to #5459 ? |
I'm not sure yet. It seems likely, however I'd expect Tomcat and Undertow to be affected too. |
When CORS is involved,
When the call is made, |
As @snicoll suspected, this is a side-effect of #5459. In 1.4.0.M3 and later, responses can be set to UTF-8 by forcing the response's content type:
The will set the charset of every response to
I'm not convinced that this should be necessary, though. @bclozel Given that the spec states that |
This has been fixed in SPR-14407 and should be available shortly as a Spring Framework 4.3.1 SNAPSHOT version. Thanks @wilkinsona ! |
Duplicates #6197 |
There is a problem in 1.4.0.M3 and 1.4.0.BUILD-SNAPSHOT, Jetty, EventSource (SseEmitter) and CORS. With this setup spring boot sends a wrong Content-Type response header back to the client.
Content-Type: text/event-stream; charset=ISO-8859-1
Chrome 51 complains with this error message
EventSource's response has a charset ("iso-8859-1") that is not UTF-8. Aborting the connection.
When the request is not sent with CORS the server sends this header
Content-Type: text/event-stream
which is okay for Chrome. Event streams must always be encoded using UTF-8
Here is a github repository that demonstrates the problem:
https://github.com/ralscha/sse-encoding
Requests to http://localhost:8080 work fine but when you do a CORS request (for example by opening index.html directly from filesystem) Chrome will complain with the above-mentioned error message.
This problem does not occur with Spring Boot 1.4.0.M2
and it does not occur with Tomcat and Undertow with 1.4.0.M3 and 1.4.0.BUILD-SNAPSHOT
The text was updated successfully, but these errors were encountered: