ALWAYS include the Vary Accept-Encoding header when response compression is enabled#55092
ALWAYS include the Vary Accept-Encoding header when response compression is enabled#55092BrennanConroy merged 14 commits intodotnet:mainfrom
Conversation
|
@pedrobsaila Sorry for the longer-than-usual delay for getting things reviewed. This is still on our radar. |
no worries |
| } | ||
|
|
||
| /// <inheritdoc /> | ||
| public bool CheckRequestAcceptsCompression(HttpContext context) |
There was a problem hiding this comment.
While I like the simplicity of this change, it essentially makes CheckRequestAcceptsCompression useless, and the logs for requests without accept-encoding are a bit odd.
It might be better to change the ResponseCompressionMiddleware to handle including the vary header when not compressing the response.
There was a problem hiding this comment.
I see there is another reviewed PR trying to fix the same issue, should I continue working on this PR o close it ?
There was a problem hiding this comment.
I would prefer continuing with the fix on this PR if you're interested.
There was a problem hiding this comment.
I duplicated the code from ResponseCompressionBody that sets Vary header in ResponseCompressionMiddleware. Should I move that code to the provider inside a new method so I can call it from both the body and middleware without duplication ?
There was a problem hiding this comment.
Should I move that code to the provider inside a new method so I can call it from both the body and middleware without duplication ?
Yeah that would be good, maybe something like bool ShouldCompressResponseCommon(IResponseCompressionProvider, HttpConext)?
There was a problem hiding this comment.
Oh, sorry I didn't see you said move to the provider. We don't need any new public API surface for this, just make it a static private method and call it from both the middleware and ResponseCompressionBody
|
Thanks for sticking with this @pedrobsaila! |
ALWAYS include the Vary Accept-Encoding header when response compression is enabled
Summary of the changes (Less than 80 chars)
Description
ALWAYS include the Vary Accept-Encoding header when response compression is enabled
Fixes #48008