-
-
Notifications
You must be signed in to change notification settings - Fork 242
Closed
Labels
Description
I'm having trouble getting compression to work properly. I've tried reading a lot of resources and your issue pages but I'm still stuck. Oddly, when I use services like http://www.whatsmyip.org/http-compression-test/ it shows that the service is compressed. But when I use chrome to simple try and go to the service, I dont see any compression happening. When I turn on DEBUG=compression I see the message
compression gzip compression +8m.
So I'd like to believe it is working, but the response in the browser shows no compression. Any advice would be great and appreciated! Thanks!
I have a seemingly simple test server/service
var compression = require('compression');
var express = require('express');
var app = express();
//turn on compression
app.use(compression({ threshold: 0 }));
// simple get service to get 10000 random numbers
app.get('/events', function (req, res) {
console.log(req.headers);
var obj = [];
for (var i = 0; i < 10000; i++) {
obj.push({
number: Math.random()
});
}
res.send(obj);
});
//start the server
var server = app.listen(80, function () {
console.log('Address', server.address());
console.log('Listening on port %d', server.address().port);
});
The headers in my req are
{ via: '1.1 DETHQTMG109',
'user-agent': 'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36',
host: 'usaievents.cloudapp.net',
'cache-control': 'max-age=0',
accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
'accept-language': 'en-US,en;q=0.8',
connection: 'Keep-Alive',
'if-modified-since': 'Tue, 20 Jan 2015 15:21:29 GMT',
'if-none-match': 'W/"YxqKyY8MDi7MUoNr2htsjg=="',
'accept-encoding': 'gzip'
}