fix: don't forward Accept-Encoding in proxy Director and WriteToKube#186
Closed
fix: don't forward Accept-Encoding in proxy Director and WriteToKube#186
Conversation
… 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Accept-Encodingfrom requests in the reverse proxy'sDirector(server.go) so the proxy's own transport owns gzip negotiation and auto-decompresses responses beforeFilterRespruns — preventing raw gzip bytes from reaching the response filter on large (>1KB) responses from kube.Accept-Encodingfrom headers forwarded to kube inWriteToKube(activity.go) for the same reason: the kube REST transport only auto-decompresses when it set the header itself (internalrequestedGzip=true); forwarding the client'sAccept-Encodingcausesres.Raw()to return compressed bytes.Test Plan
adminClient, retrieves it through the proxy aspaulClient— validates the Director fix (Path 1)TestWriteToKubeDoesNotForwardAcceptEncoding: captures headers sent to the fake kube client and assertsAccept-Encodingis absent — validates theWriteToKubefix (Path 2)go test ./...)🤖 Generated with Claude Code