X-Content-Encoding-Over-Network in Response Header but not Content-Encoding
Asked Answered
R

1

26

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
};
Robustious answered 15/10, 2019 at 9:48 Comment(1)
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.Kitchenmaid
K
18

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

Krys answered 6/3, 2020 at 10:18 Comment(1)
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.Boutte

© 2022 - 2024 — McMap. All rights reserved.