Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using gzip to compress rest response

I have a rest service which is exposed to end user. This service sends response(say 500K) and the response times are high.

How can we use Gzip to compress the response and send.

I'm using Spring boot and maven.

Thanks in advance.

like image 957
user1879835 Avatar asked Nov 29 '25 01:11

user1879835


1 Answers

The GZIP configuration was updated in Spring Boot release 1.3. Now, the correct handling is to use server.compression.enabled property.

server.compression.enabled=true

See the Enable HTTP response compression chapter in the reference docs for configuration details such as response size and content type. Please read the Release Notes for the motivations of this change.

like image 135
matsev Avatar answered Nov 30 '25 22:11

matsev



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!