24

I'm trying to compress the code written with Next.js using Gzip deliver with Nginx and NodeJS server.

It seems the config is working when I use curl -H "Content-Encoding: gzip" to verify.
But come to real browser (Chrome, Firefox) I cannot find the Content-Encoding: gzip property in Response Headers.
Instead, X-Content-Encoding-Over-Network: gzip is appeared.

I use Google Lighthouse to test though the site, it blames me to enable compression on text file.

Actually, what does X-Content-Encoding-Over-Network mean?
How can I get the gzip work with this?

Nginx setting:

gzip on;
gzip_disable "msie6";

gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.0;

gzip_types
    text/css
    text/plain
    text/javascript
    application/javascript
    application/json
    application/x-javascript
    application/xml
    application/xml+rss
    application/xhtml+xml
    application/x-font-ttf
    application/x-font-opentype
    application/vnd.ms-fontobject
    image/svg+xml
    image/x-icon
    application/rss+xml
    application/atom_xml;

Next.js Setting

// next.config.js
module.exports = {
  compress: true
};
pppery
  • 3,731
  • 22
  • 33
  • 46
Asahi
  • 251
  • 2
  • 6
  • 11
    I'm not sure. However, it could be related to antivirus. In some cases _ESET_ (for example) can unzip response to check it. Try to disable _HTTP Scanner_ in the antivirus options. – mykhailo.romaniuk Nov 20 '19 at 15:12

1 Answers1

16

Your configuration is just good. Sometimes, the problem is caused by Antivirus just like mentioned in comment. Try disabling the antivirus or instead search for HTTP Scanning option in your antivirus program.

NOD Internet Security does this. You can disable this option by following,

1) Open NOD Internet Security

2) Click Setup then Advance Setup

3) Search for HTTP

4) Disable HTTP Scanner

Airy
  • 5,484
  • 7
  • 53
  • 78
  • 2
    This worked for me. I wanted to exclude my domain from being scanned completely from NOD32. However when I added it to the excluded list, it appeared to continue unzipping the content, scan it and modify the headers. – evesnight Jun 19 '21 at 20:27