Skip to content

Commit 4314e73

Browse files
authored
[StaticWebAssets] Fix Vary header in Static Web Assets compression negotiation to use Accept-Encoding (#50151)
The ApplyCompressionNegotiation task was incorrectly setting the Vary header to "Content-Encoding" when serving compressed static web assets. According to HTTP specifications, the Vary header should indicate which request headers the server considers when determining the response, not which response headers are set. When serving compressed content, the server should set Vary: Accept-Encoding to indicate that the response varies based on the client's Accept-Encoding request header (which tells the server what compression formats the client supports).
1 parent 35c6ce5 commit 4314e73

File tree

72 files changed

+6507
-6507
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+6507
-6507
lines changed

src/StaticWebAssetsSdk/Tasks/ApplyCompressionNegotiation.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ private static StaticWebAssetEndpointResponseHeader[] CreateCompressionHeaders(S
191191
new()
192192
{
193193
Name = "Vary",
194-
Value = "Content-Encoding"
194+
Value = "Accept-Encoding"
195195
}
196196
];
197197

0 commit comments

Comments
 (0)