'springboot gzip Content-Encoding:gzip not showing

I've been trying to add gzip compression to my apis in java springboot, however the api response size is still the same after adding properties. Wondering if anyone occurred the same situation?

springboot version: Springboot 2.3.6 RELEASE

application.properties:

    server.compression.enabled=true
    server.compression.mime-types=application/json,application/xml,text/html,text/xml,text/plain,application/javascript,text/css
    server.compression.min-response-size=1024

expection:

  • response size reduced,

  • Content-Encoding: gzip showing in response

result:

  • neither happened
  • [web response][1] [1]: [https://i.stack.imgur.com/ydOep.png][1]

update & solved:

found reason, tested response size from swagger, which doesn't set request header("Encoding-Content", "gzip") by default, adding set request header("Encoding-Content") at web-side should display the corrected result.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source