question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

1.4.0.M3: SseEmitter, Jetty, CORS: Wrong charset in Content-Type header

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
bclozelcommented, Jun 27, 2016

This has been fixed in SPR-14407 and should be available shortly as a Spring Framework 4.3.1 SNAPSHOT version.

Thanks @wilkinsona !

0reactions
snicollcommented, Jun 27, 2016

Duplicates #6197

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found