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
};