I am trying to implement Gzip response compression in my Springboot Rest API

I am using below configuration in my application.properties

Enable response compression:

server.compression.enabled=true The comma-separated list of mime types that should be compressed:

server.compression.mime-types=text/html,text/xml,text/plain,text/css,text/javascript,application/javascript,application/json Compress the response only if the response size is at least 10KB:

server.compression.min-response-size=102400 Response compression is happening, but the strange thing is that it is also compression responses having size as low as 10KB or 15KB which it should not as server.compression.min-response-size=102400

Comment From: bclozel

Can you provide a sample application that reproduces the problem? Ideally, a minimal application create on start.spring.io and pushed to GitHub as a repository (or attached to this issue as a zip file). Thanks!

Comment From: mayuresh-chandwadkar

Its simple springboot application and I have used below 4 properties in application.properties to compress the response.

server.compression.enabled=true
server.compression.mime-types=application/json,application/xml,text/html,text/xml,text/plain
server.compression.min-response-size=102400
server.compression.excluded-user-agents=MSIE 6.0,UCBrowser

I can not share my appication code here due to org policy. Its simplete spingboot application project uses dependency of springboot. And we deploy this to fargate service in AWS.

Comment From: mayuresh-chandwadkar

API_Response_Header_Screenshot_Retun_response_6K

Comment From: wilkinsona

Much of this has already been covered in https://github.com/spring-projects/spring-boot/issues/19942 which you also commented on. Please read through that issue again. If your responses have a Content-Length header and they're still being compressed when they are less than the minimum response size, we will need the sample that Brian requested. It doesn't have to be your actual application, just something minimal that reproduces the problem.

Comment From: spring-projects-issues

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

Comment From: spring-projects-issues

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.