Compress Module for Express Server Not Zipping

时间:2017-08-04 12:52:41

标签: node.js express server compression gzip

I have installed node.js and am running a simple express server on my local machine. I have included the compress module and make the call for app (instance of express) to use this module. After debugging, my request appears to be passing through the filter with the option to be encoded with gzip, but when transmitting the response it is not encoded. Are there other common reasons I am overlooking for why this is the case?

Please see request header and source code in images linked below. (It should be noted that file 1 is actually being retrieved, but not encoded)

Source
Headers

1 个答案:

答案 0 :(得分:0)

经过几天的努力,我得出结论,问题不在于服务器或压缩中间件,而在于我所使用的网络上使用的代理。数据确实以压缩(gzip)的形式发送,但代理在拦截响应并在到达浏览器之前对其进行解压缩。因此,它似乎已被解压缩(在响应头中)。

有用的提示:仔细阅读已知问题!

c.f。 https://github.com/expressjs/compression/issues/31