GzipHandler fails to set Vary header on 304 responses #8905
Labels
Bug
For general bugs on Jetty side
Specification
For all industry Specifications (IETF / Servlet / etc)
Jetty version(s)
11.0.12
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
RFC 9110 states that a 304 response must generate a
Vary
header matching that generated by the equivalent 200 response:Jetty's
GzipHandler
adds aVary
header for 200 responses it gzips, but doesn't add it for corresponding 304 responses.GzipHttpOutputInterceptor
, whichGzipHandler
uses to modify responses, infers from the ETag whether a 304 response it is handling refers to a resource it previously compressed, so perhaps theVary
header could be added at this point?How to reproduce?
Using the following class:
Visiting http://localhost:8080/foo in a browser will result in a gzipped 200 response with
Vary
headerVary: Accept-Encoding
(andETag
e.g.ETag: "9af0190a-7fb3-4511-873c-75a6fad51345--gzip"
). Visiting the same address again will result in a 304 response, but with noVary
header (with the sameETag
The text was updated successfully, but these errors were encountered: