We can enable GZip compression in Spring Boot by
server.compression.enabled=true
server.compression.mime-types=text/xml,application/xml,application/json
server.compression.min-response-size=1024
We also can enable the request or response GZIP compression for ourFeign requests by
feign.compression.request.enabled=true
feign.compression.response.enabled=true
feign.compression.request.mime-types=text/xml,application/xml,application/json
feign.compression.request.min-request-size=1024
When we config server.compression.enabled=true in server-side and feign.compression.response.enabled=true at the same time. There will be something wrong:
The server can handle the request as normal, but the client recieve wrong response.
There is an example in my github to reproduce the problem.
Reproduce problem steps: 1. Run the server application 2. Run the client application 3. HTTP GET from http://localhost:8002/client/get
Phenomenon:
1. Under normal circumstances, we will get the normal response, "String from server".
2. But when we config server.compression.enabled=true in server-side and feign.compression.response.enabled=true in client-side at the same time, we will get garbled, like ".)��KWH+��U(N-*K-".
The issue is same as https://github.com/spring-cloud/spring-cloud-openfeign/issues/145, but I did not get answer in that issue, so I ask again.
Comment From: ryanjbaxter
@OlgaMaciaszek explained why this is the case in #145 and what you can do to work around it