Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions internal/xds/translator/compressor.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,9 @@ func (*compressor) patchRoute(route *routev3.Route, irRoute *ir.HTTPRoute, _ *ir
route.TypedPerFilterConfig[filterName] = compressorAny
}

// Remove accept-encoding header to prevent double compression
route.RequestHeadersToRemove = append(route.RequestHeadersToRemove, "accept-encoding")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why aren't we using the setting from the filter

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't work correctly, at all. If I append apply the removeAcceptEncodingHeader on every compressor (no matter if its on the HCM one or the route overrides), it stops compression all together. If I apply it on one, it works, but it will only remove that header if that compression is picked.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I filed this in the meantime: envoyproxy/envoy#42160

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, lets wait for the outcome of this before pushing code that needs to be updated again


return nil
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
name: httproute-1
namespace: default
name: httproute/default/httproute-1/rule/0/match/0/gateway_envoyproxy_io
requestHeadersToRemove:
- accept-encoding
route:
cluster: httproute/default/httproute-1/rule/0
upgradeConfigs:
Expand Down
12 changes: 12 additions & 0 deletions test/e2e/tests/compression.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,12 @@ func testCompression(t *testing.T, suite *suite.ConformanceTestSuite, compressio
"Accept-encoding": encoding,
},
},
ExpectedRequest: &http.ExpectedRequest{
Request: http.Request{
Path: "/compression",
},
AbsentHeaders: []string{"Accept-Encoding"},
},
Response: http.Response{
StatusCodes: []int{200},
Headers: map[string]string{
Expand Down Expand Up @@ -148,6 +154,12 @@ func testCompressionChooseFirst(t *testing.T, suite *suite.ConformanceTestSuite,
"Accept-encoding": "gzip, br, zstd",
},
},
ExpectedRequest: &http.ExpectedRequest{
Request: http.Request{
Path: "/compression",
},
AbsentHeaders: []string{"Accept-Encoding"},
},
Response: http.Response{
StatusCodes: []int{200},
Headers: map[string]string{
Expand Down
Loading