1.4.0.M3: SseEmitter, Jetty, CORS: Wrong charset in Content-Type header
See original GitHub issueThere 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
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (7 by maintainers)
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