Frode Austvik created CXF-7404:
----------------------------------
Summary: The GZIP feature should set Vary: Accept-Encoding always
Key: CXF-7404
URL: https://issues.apache.org/jira/browse/CXF-7404
Project: CXF
Issue Type: Bug
Components: Transports
Affects Versions: 3.1.11
Reporter: Frode Austvik
Priority: Minor
At the moment, {{Accept-Encoding}} is added to the {{Vary}} header by
{{[GZIPOutInterceptor.GZipThresholdOutputStream|https://github.com/apache/cxf/blob/cxf-3.1.11/core/src/main/java/org/apache/cxf/transport/common/gzip/GZIPOutInterceptor.java#L300]}}
only when the content is actually being compressed, while it should also be
added to responses that _could_ have been compressed if the client accepted
gzip encoding - at least according to my reading of [RFC 7231 (section
7.1.4)|https://tools.ietf.org/html/rfc7231#section-7.1.4]:
{quote}
An origin server SHOULD send a Vary header field when its algorithm
for selecting a representation varies based on aspects of the request
message other than the method and request target,
{quote}
I think the main underlying reason for this is that, otherwise, a cache might
get stuck serving a sub-optimal variant - in our case sending uncompressed data
to clients that support gzip, as we're not telling it that a compressed variant
is also available.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)