Skip to content
Advertisement

Compression is not working in spring but, it is showing Content-Encoding as gzip in the response headers

I am trying to compress the response from a java spring-boot application. I referred to some tutorials and StackOverflow questions and found that I just have to add these lines

JavaScript

in the application.properties file, so I went ahead and added those, but after adding these lines, I am getting the Content-Encoding as gzip but the size of the response is the same as before, I also double-checked the size by removing them and the only thing that was changing was the Content-Encoding type and the size isn’t getting affected. I am using the embedded tomcat server for the API which sends the model

JavaScript

and my spring-boot version is 2.4.5 Am i missing some thing here?

Advertisement

Answer

This might be the issue when we test with postman, as asked here, so inorder to verify, i tried with chrome and i got the compressed size(transfered over network) and also the actual size which is displayed as (resource size), along with the header “Content-Encoding” as “gzip”.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement