title: Gzip compression not working in my project with Spring boot 1.5.10.RELEASE
body: <p>I am using Spring Boot 1.5.10.RELEASE version. Gzip compress not working.</p>
  <blockquote>
  <p>http://localhost:9000 --&gt; http://localhost:8080/api/..</p>
  </blockquote>
  <p>Angularjs &amp; rest api on different  Port. Enabled CrossOrigin to accept request from angularjs ui.</p>
  <p>Using embedded tomcat server to deploy spring boot application.
  Not using http2 property i.e. <code>server.http2.enabled=true</code></p>
  <p>Angualrjs calls rest api. Following is $http service</p>
  <pre><code>$http({
    method: method,
    url: url,
    params: params,
    data: body,
    headers: {
      Authorization: token,
      &quot;Content-type&quot;: 'application/json'
    }
  });
  </code></pre>
  <p>Rest api response size Approx 25 MB so I want to compress response.</p>
  <p>I have added well known property in <strong>application.properties</strong> to apply gzip compression.
  <a href="https://docs.spring.io/spring-boot/docs/1.5.10.RELEASE/reference/html/common-application-properties.html" rel="nofollow noreferrer">Spring boot 1.5.10 Supported properties</a></p>
  <pre><code># 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 1KB
  server.compression.min-response-size=1024
  </code></pre>
  <p>I have observed network tab and no observed <strong>Content-Encoding: gzip</strong> in response header.</p>
  <p><strong>Request</strong></p>
  <pre><code>Request URL: http://localhost:9081/employee
  Request Method: GET
  Status Code: 200 
  Remote Address: [::1]:9081
  Referrer Policy: no-referrer-when-downgrade
  </code></pre>
  <p><strong>Response Header</strong></p>
  <pre><code>Access-Control-Allow-Credentials: true
  Access-Control-Allow-Origin: http://localhost:7000
  Cache-Control: no-cache, no-store, max-age=0, must-revalidate
  Content-Type: application/json;charset=UTF-8
  Date: Sun, 28 Jun 2020 18:15:17 GMT
  Expires: 0
  Pragma: no-cache
  Set-Cookie: JSESSIONID=6E7C07874D0329E18A0C07E5E303F005; Path=/; HttpOnly
  Transfer-Encoding: chunked
  Vary: Origin
  X-Application-Context: application
  X-Content-Type-Options: nosniff
  X-Frame-Options: DENY
  X-XSS-Protection: 1; mode=block
  </code></pre>
  <p><strong>Request Header</strong></p>
  <pre><code>Accept: */*
  Accept-Encoding: gzip, deflate, br
  Accept-Language: en-US,en;q=0.9
  Authorization: Bearer eyJhbGciOiJIUzINiJ9.eyJyb2xlIjiU0VDVE9SSEVBRCIsImxldmVsRG93biI6IkVENzA0MTI7TU04MzcyNDtKTDgzNTwO0RNNDAwNzE7Skc3MzA0NjtFQzM0NjEzO05OMTY5Nzk7QUs2MDYzNztTVDE4NTg4O0FTMjczNTE7Q0I4MTg3OTtWQTc4MTk5O0NNOTM3MDA7QVkyMzYzNztKUzcwMDY4O0NCMTc2NzE7TksyMTU2MDtMUzg4OTg0O0FQNTg3MDg7VFcyjk0NTtKSzI1Nzc3O01TNDk5MjE7SkI4OTcyOTtNSDAyMTI3O01CMTUwODk7SU0xMjgwODtNQzcxOTc2O1JSMjAzMDI7TFM1ODk4MiIsImxldmVsVXAiOm51bGwsImRlbGVnYXRlZCI6bnVsbCwic29lSWQiOiJTUjQ0MTg1I0.*************
  Cache-Control: no-cache
  Connection: keep-alive
  Content-type: application/json
  Host: localhost:9081
  Origin: http://localhost:7000
  Pragma: no-cache
  Referer: http://localhost:7000/build/standalone.html
  Sec-Fetch-Dest: empty
  Sec-Fetch-Mode: cors
  Sec-Fetch-Site: same-site
  User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36
  </code></pre>
  <p>I am not getting following expected headers in response header</p>
  <pre><code>Content-Encoding: gzip
  Vary: Accept-Encoding
  </code></pre>
  <p>Any changes require at client /server side ?</p>
  <p>---[Edit-1] -------------
  Tried gzip in individual project which worked but not worked in my project.</p>
  <p>Following is response header when invoke rest api from browser</p>
  <pre><code>Content-Encoding: gzip
  Content-Type: application/json;charset=UTF-8
  Date: Sun, 28 Jun 2020 18:12:29 GMT
  Transfer-Encoding: chunked
  Vary: Accept-Encoding
  </code></pre>
  <p>-----[Edit-2]-----Ziplet----</p>
  <p>Using <a href="https://stackoverflow.com/a/39027711/297907">ziplet</a> dependency I am able to compress response, but I want to use spring boot gzip compression.</p>
  <p>Response header - when used Ziplet</p>
  <pre><code>Access-Control-Allow-Credentials: true
  Access-Control-Allow-Origin: http://localhost:7000
  Cache-Control: no-cache, no-store, max-age=0, must-revalidate
  Content-Encoding: gzip
  Content-Type: application/json;charset=UTF-8
  Date: Mon, 06 Jul 2020 18:31:07 GMT
  Expires: 0
  Pragma: no-cache
  Set-Cookie: JSESSIONID=8465D2E81A1A9CE146255B6C545FBE30; Path=/; HttpOnly
  Transfer-Encoding: chunked
  Vary: Accept-Encoding
  Vary: Origin
  X-Application-Context: application
  X-Content-Type-Options: nosniff
  X-Frame-Options: DENY
  X-XSS-Protection: 1; mode=block
  </code></pre>
  <h2>When used ziplet - I can see
  <em><strong>CompressingFilter    : CompressingFilter has initialized</strong></em></h2>
  <p>When using Spring boot gzip compression not observed anything where I can assume gzip compression enabled.</p>
  <p>Any property to debug spring boot gzip compression with embeded tomcat ?
  like logging.level.org.eclipse.jetty.server.handler.gzip=TRACE</p>
  <p>How can i verify server.compression.enabled ?</p>
  <p>Any changes require at client /server side in my project?</p>
  <p>Thanks in advance.</p>