-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Gzip will compress the compressed body again #47
Comments
I had the same problem,Can we do like this ?
|
@SinuxLee I don't think it's a good idea. |
@LawyZheng 👍 Looking forward to your PR. Maybe, I can help to review the code :) |
Any update on this issue? |
waiting for PR merge |
Gzip will compress the compressed body again when I use third-party handlers to handle gin context,
like
httputil.ReverseProxy
,promhttp
.It seems if the target HTTP server returns a gzip-compressed body, the middleware will compress it again,
which could result in the client can't decompress the response correctly.
For example, Prometheus can't scrape the target response correctly or some responses will be garbled, due to the double compression.
Though I can solve this problem by setting the
gzip.WithExcludedPaths
or other ExcludedOptions, I don't think it is the best way. Because sometimes we want to solve this problem more wisely and elegantly, rather than coding the ExcludedOptions hardly.I also tried to fix this problem by myself. And past all default unit tests.
Am I welcomed to make a pr?
The text was updated successfully, but these errors were encountered: