Closed tranhungt closed 7 years ago
@tranhungt how about a PR?
@ryanjbaxter Sure thing, glad to. :)
I'm facing the same issue and I've created a test project https://github.com/lifeisfoo/zuul-no-gzip-response.
Run the project and call GET http://localhost:9090/httbin/gzip
with the "Accept-Encoding: gzip" header.
Not sure where to put the tests for this. @ryanjbaxter ?
If the changes were made in SimpleHostRoutingFilter
how about in SimpleHostRoutingFilterTests
https://github.com/spring-cloud/spring-cloud-netflix/blob/12fff7c97f04f6000c74db066e92c87d9071ea4d/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/zuul/filters/route/SimpleHostRoutingFilterTests.java
@tranhungt are you still planning a pull request? I stumbled on the exact same issue, and temporarily fixed it on my project by subclassing the filter, but I would rather see a permanent fix in the root filter.
@gvdenbro yeah, sorry, I've just been busy with finishing up projects at work for end of year. Will put in the PR over the holidays. :)
I'm glad you got a temporary solution to work though!
@ryanjbaxter Thanks for the wait and recommendation. PR is up now. Let me know if it looks good with you. //cc @gvdenbro https://github.com/spring-cloud/spring-cloud-netflix/pull/1591
The http client by default decompresses the GZIP data and therefore does not pass on the response exactly as it received from downstream services. This is an issue when the user request compressed (gzip) data via accept-encoding header, which the downstream respects by sending compressed gzip, but zuul changes the response signature by decompressing the response.
The solution is to add
.disableContentCompression()
on thehttpClientBuilder
.http://stackoverflow.com/questions/30216375/extracting-gzip-data-from-apache-httpclient-without-decompression
https://github.com/spring-cloud/spring-cloud-netflix/blob/master/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/filters/route/SimpleHostRoutingFilter.java#L236