Skip to content

fix: don't forward Accept-Encoding in proxy Director and WriteToKube#186

Closed
ecordell wants to merge 1 commit intomainfrom
gz-support
Closed

fix: don't forward Accept-Encoding in proxy Director and WriteToKube#186
ecordell wants to merge 1 commit intomainfrom
gz-support

Conversation

@ecordell
Copy link
Copy Markdown
Collaborator

@ecordell ecordell commented Mar 4, 2026

Summary

  • Strip Accept-Encoding from requests in the reverse proxy's Director (server.go) so the proxy's own transport owns gzip negotiation and auto-decompresses responses before FilterResp runs — preventing raw gzip bytes from reaching the response filter on large (>1KB) responses from kube.
  • Strip Accept-Encoding from headers forwarded to kube in WriteToKube (activity.go) for the same reason: the kube REST transport only auto-decompresses when it set the header itself (internal requestedGzip=true); forwarding the client's Accept-Encoding causes res.Raw() to return compressed bytes.

Test Plan

  • E2e test: creates a 300KB configmap via adminClient, retrieves it through the proxy as paulClient — validates the Director fix (Path 1)
  • Unit test TestWriteToKubeDoesNotForwardAcceptEncoding: captures headers sent to the fake kube client and asserts Accept-Encoding is absent — validates the WriteToKube fix (Path 2)
  • All existing unit tests pass (go test ./...)

🤖 Generated with Claude Code

… fix

Add e2e test that creates a 300KB configmap and retrieves it through the
proxy, confirming the Director's Accept-Encoding stripping prevents
compressed responses from leaking into FilterResp.

Add unit test TestWriteToKubeDoesNotForwardAcceptEncoding that directly
verifies WriteToKube does not forward Accept-Encoding to the kube REST
client. The kube transport only auto-decompresses when it set the header
itself (requestedGzip=true), so forwarding it would cause res.Raw() to
return compressed bytes on large responses.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions github-actions Bot added area/tooling Affects the dev or user toolchain area/core labels Mar 4, 2026
@ecordell ecordell closed this Mar 4, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 4, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area/core area/tooling Affects the dev or user toolchain

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant