-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
GzipHandler fails to set Vary header on 304 responses when client does not accept gzip encoding #9042
Comments
The request We can put What specific User Agent scenario are you dealing with? |
In this case Jetty is serving a REST API, so the user agents are a mixture of browsers and various languages' HTTP clients. Adding to the mix, I've got a Varnish Cache reverse proxy in front of Jetty. The problem with adding I agree with you that the |
This issue has been automatically marked as stale because it has been a |
I think this issue may be related to #11210, where the logic to add the |
Issue #8907 also shows another possible GzipHandler issue |
Jetty version(s)
11.0.13
Java version/vendor
(use: java -version)
openjdk version "11.0.17" 2022-10-18
OpenJDK Runtime Environment (build 11.0.17+8-post-Ubuntu-1ubuntu220.04)
OpenJDK 64-Bit Server VM (build 11.0.17+8-post-Ubuntu-1ubuntu220.04, mixed mode, sharing)
OS type/version
Linux 5.4.0-120-generic
Description
#8906 improves the handling of 304 responses by the
GzipHandler
by setting thevary
header on 304 responses that would have had that same header set on a 200 response. It works by identifying that an ETag sent by the client has a signature implying it was generated by theGzipHandler
in the first place. However (and I feel a little guilty here as the implementation was my suggestion in #8905), this doesn't work whenGzipHandler
returns an uncompressed response due to a client not accepting gzip encoding. In this case,GzipHandler
correctly adds avary
header to a 200 response, but because the resultant ETag has no identifying marks added to it, a subsequent 304 response doesn't have thevary
header set.Unfortunately, I didn't realise this until I tried 11.0.13 today :(
How to reproduce?
Use the following class:
Outputs:
The text was updated successfully, but these errors were encountered: