Skip to content
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

Management SSE for apps fails when Accept-Encoding is sent #8518

Closed
gbbirkisson opened this issue Nov 30, 2020 · 4 comments
Closed

Management SSE for apps fails when Accept-Encoding is sent #8518

gbbirkisson opened this issue Nov 30, 2020 · 4 comments

Comments

@gbbirkisson
Copy link
Contributor

You can make the SSE endpoint for apps return a 200 but still fail by adding Accept-Encoding: gzip, deflate to the request headers.

$ curl -v --user 'su:bla' -N \
    -H 'Accept: text/event-stream' \
    -H 'Accept-Encoding: gzip, deflate' \
    http://localhost:4848/app/events

*   Trying 127.0.0.1:4848...
* Connected to localhost (127.0.0.1) port 4848 (#0)
* Server auth using Basic with user 'su'
> GET /app/events HTTP/1.1
> Host: localhost:4848
> Authorization: Basic blabla
> User-Agent: curl/7.73.0
> Accept: text/event-stream
> Accept-Encoding: gzip, deflate
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Date: Mon, 30 Nov 2020 15:30:18 GMT
< Set-Cookie: JSESSIONID=s0rk7cjder9q1ev2utc5xkp5u66; Path=/; HttpOnly
< Expires: Thu, 01 Jan 1970 00:00:00 GMT
< Content-Type: text/event-stream
< Vary: Accept-Encoding
< Content-Encoding: gzip
< Transfer-Encoding: chunked
< 
Warning: Binary output can mess up your terminal. Use "--output -" to tell 
Warning: curl to output it to your terminal anyway, or consider "--output 
Warning: <FILE>" to save to a file.
* Failure writing output to destination
* Failed reading the chunked-encoded stream
* Closing connection 0

Remove the Accept-Encoding header and everything is fine.

@rymsha rymsha self-assigned this Nov 30, 2020
@rymsha rymsha added this to the 7.6.0 milestone Nov 30, 2020
@rymsha rymsha added the Bug label Nov 30, 2020
@rymsha rymsha removed this from the 7.6.0 milestone Nov 30, 2020
@anatol-sialitski
Copy link
Contributor

@gbbirkisson try to use -H 'Content-Type: text/event-stream' -H 'Content-Encoding: gzip, deflate' instead

@rymsha
Copy link
Contributor

rymsha commented Nov 30, 2020

@anatol-sialitski
Well, your option will work, but only because it won't have Accept-Encoding header.
Apache Httpclient sends Accept-Encoding, and for (still) unknown reason it is problematic.
I'm on this issue

@rymsha
Copy link
Contributor

rymsha commented Dec 1, 2020

Jetty and Resteasy (at least 3.x) SSE implementation don't work well together when client wants gzip (advertises via Accept-Encoding)

Easiest way for now is to disable compression for text/event-stream responses.

@rymsha rymsha changed the title Management SSE for apps fails on a particular header combination Management SSE for apps fails when Accept-Encoding is sent Dec 1, 2020
@rymsha
Copy link
Contributor

rymsha commented Jun 3, 2021

jetty/jetty.project#4317

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants