I am using Spring Boot version 2.7.9. Currently I am trying to enable text compression in my application, where the property file looks like below,
application.properties:
server.compression.enabled=true
server.compression.mime-types=application/javascript,application/json,application/octet-stream,application/pdf,font/woff,font/woff2,image/jpeg,image/png,image/svg+xml,image/x-icon,text/html,text/xml,text/plain,text/css
# Compress the response only if the response size is at least 1KB
server.compression.min-response-size=1024
When I check the requests in my application some of the javascripts are holding the Content-Encoding response header with value as gzip and some are not having it, even though they are more than 1kb size.
Also, for the image files and fonts such as .svg, .png, .jpg, .woff and .woff2 is also not getting compressed (not even single image is compressed). I am trying to compress those files since some of the images are bit large.
Note: In Azure, tomcat compression will be enabled by default. I have turned off by modifying server.xml manually.
I have also gone through one of the previous question, but there is no preferable answer for doing it.
Please help, TIA.