i'm trying to make nginx as proxy_server to nodejs app on port 3000 for testing purpose with compression, when doing this:
curl -I -H 'Accept-Encoding: gzip, deflate' http://localhost/json
i go this:
and when curl it with -i with body shown
curl -i -H 'Accept-Encoding: gzip, deflate' http://localhost/json
i got this:
in nginx.conf file:
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://localhost:3000;
}
in node app.js
//..
app.get('/json',(req,res)=>{
res.json({Hello:'JSON'})
});
and again this seems weird when send some text for testing gzip
app.get('/', (req,res)=>{
res.end('lorem ipsum ........ 100(lorem ipsum long text) ');
});
the content not reduced but when i add explicitly content-type the content size got compressed.
app.get('/', (req,res)=>{
res.setHeader('Content-type','text/html');
res.end('lorem ipsum ........ 100(lorem ipsum long text) ');
});