Fix stale Content-Encoding header in ProxyServlet after HttpClient bump - #7937
Open
labkey-tchad wants to merge 2 commits into
Open
Fix stale Content-Encoding header in ProxyServlet after HttpClient bump#7937labkey-tchad wants to merge 2 commits into
labkey-tchad wants to merge 2 commits into
Conversation
HttpClient5 5.6+ stopped stripping Content-Encoding/Content-Length after auto-decompressing responses, so ProxyServlet forwarded a decompressed body under a stale compressed-encoding header. Disable auto-decompression so bytes and headers always stay consistent.
…fb_httpClientUpgrade
Member
Author
|
Verifying with RStudio on TeamCity: https://teamcity.labkey.org/buildConfiguration/LabKey_267Release_Premium_ModulesSuites_RStudioPostgres/4134256 |
XingY
requested changes
Aug 16, 2026
XingY
left a comment
Contributor
There was a problem hiding this comment.
It seems our ProxyServlet diverged from the original implementation:
https://github.com/mitre/HTTP-Proxy-Servlet/blame/9a522c5c021e6941cd951941ed49d96ff996f1eb/src/main/java/org/mitre/dsmiley/httpproxy/ProxyServlet.java#L286
Based on the original code, if should check doHandleCompression to set the config.
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Rationale
Apache HttpClient5 5.6+ no longer strips the Content-Encoding/Content-Length headers it leaves behind after auto-decompressing a response entity (5.5.x stripped them via ContentCompressionExec). This surfaced while updating our httpclient5 dependency from 5.5.2 to 5.6.4: ProxyServlet.copyResponseHeaders() forwards those stale headers verbatim, so a gzip-compressed backend response arrives at the browser with an already-decompressed body but a Content-Encoding: gzip header still attached — browsers reject this as an invalid/unsupported compression form (surfaced via the RStudio Workbench auth-sign-in proxy path).
Related Pull Requests
Changes