Gzip compression not working when passed through Auth0

I am trying to enable gzip compression in an app authenticated by Auth0. I am using the Kubernetes nginx controller with snippets enabled. The ingress has the following snippet:

    nginx.ingress.kubernetes.io/server-snippet: |
      gzip on;
      gzip_http_version 1.1;
      gzip_comp_level 6;
      gzip_vary on;
      gzip_proxied any;
      gzip_types
          text/plain
          application/javascript
          text/css
          application/json
          application/x-javascript
          text/xml
          application/xml
          application/xml+rss
          text/javascript
          application/vnd.ms-fontobject
          application/x-font-ttf
          font/opentype;

However I can see there is no content-encoding: gzip header in the response.

I can force this header by adding

nginx.ingress.kubernetes.io/configuration-snippet: |
   more_set_headers "Content-Encoding: gzip";

however I am not sure this will actually compress the resources and I would prefer to use the nginx configuration language to enable this.

I have confirmed that this snippet works when used with an ingress that does not go through Auth0.

Any help would be greatly appreciated.

This turned out to not be an Auth0 issue at all - I was getting 304 status codes which according to this article compression - Why does "Disable Cache" in Chrome developer tools change the "content-encoding: gzip" response header? - Webmasters Stack Exchange 304s indicate the content is being cached by the browser which means there is no content to gzip. If I check “Disable cache” in developer tools I can see the gzipped content. So this is not an Auth0 issue at all - the gzip compression is working!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.