Reputation: 682
I'm using Spring Boot 2.0.6.RELEASE and trying to get the internal Tomcat server to GZip the responses from the API I'm working on. As per the spring boot documentation https://docs.spring.io/spring-boot/docs/2.0.6.RELEASE/reference/htmlsingle/#how-to-enable-http-response-compression adding server.compression.enabled=true
to the application.properties should enable embedded web server's compression.
However the response I'm getting from the API doesn't look compressed.
I've followed this question Spring boot response compression not working and when inspecting the ServerProperties's Compression object when application starts up, it looks like the enabled property is set to false.
What am I missing here?
Upvotes: 3
Views: 15029
Reputation: 21
Compression is disabled if strong Etag is enabled. I was using ShallowEtagHeaderFilter and as soon as I removed it, compression started working.
Upvotes: 1
Reputation: 701
Specify mime-types
with compression like below.
server.compression.enabled=true
server.compression.mime-types=application/json,application/xml,text/html,text/xml,text/plain
Upvotes: 2