You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When sending a request through the proxy, and the target server supports gzip encoding, and the requesting client accepts gzip, then the proxy will produce no output.
When the Accept-Encoding header is not explicitly set on a request, the default http.Transport will add the header itself and transparently decode the resulting response body. However if the request explicitly sets the Accept-Encoding header, the response is not automatically decoded.
Because the proxy copies all headers from the client request to the proxied request, if the client is a browser it is very likely that the Accept-Encoding header will be explicitly set by the copy, with the result being that the proxy receives compressed data back from the server and barfs on it.
There are a couple of potential ways I can see to solve this:
Omit the Accept-Encoding header when copying headers from client req to proxied req to allow transparent decompression. This approach may introduce some surprise if users expect to be able to specify some alternative encoding and have it honored.
Handle decompression explicitly in the presence of Content-Encoding: gzip in the server response.
A similar issue exists on the proxied response, since the Content-Encoding header is copied to the outbound response but the response is not correctly encoded. I suspect that honoring the Content-Encoding header on the response side is likely to be rather more complicated, since the correct encoding on the response would have to be generated (gzip / compress / whatever).
The text was updated successfully, but these errors were encountered:
When sending a request through the proxy, and the target server supports gzip encoding, and the requesting client accepts gzip, then the proxy will produce no output.
When the
Accept-Encoding
header is not explicitly set on a request, the default http.Transport will add the header itself and transparently decode the resulting response body. However if the request explicitly sets theAccept-Encoding
header, the response is not automatically decoded.Because the proxy copies all headers from the client request to the proxied request, if the client is a browser it is very likely that the
Accept-Encoding
header will be explicitly set by the copy, with the result being that the proxy receives compressed data back from the server and barfs on it.There are a couple of potential ways I can see to solve this:
Accept-Encoding
header when copying headers from client req to proxied req to allow transparent decompression. This approach may introduce some surprise if users expect to be able to specify some alternative encoding and have it honored.Content-Encoding: gzip
in the server response.A similar issue exists on the proxied response, since the
Content-Encoding
header is copied to the outbound response but the response is not correctly encoded. I suspect that honoring theContent-Encoding
header on the response side is likely to be rather more complicated, since the correct encoding on the response would have to be generated (gzip / compress / whatever).The text was updated successfully, but these errors were encountered: