expressjs / compression

Node.js compression middleware
MIT License
2.77k stars 241 forks source link

chrome lighthouse text compression #142

Closed pYr0x closed 6 years ago

pYr0x commented 6 years ago

i have searched the closed issues and found some others that have the same problem. but no solution i enabled compression with app.use(compression({ threshold: 0 }));

so i dont know whats going on there.

i am using:

dougwilson commented 6 years ago

Either it's a bug with whatever Chrome Lighthouse is, or it's a bug in this module. If it's a bug in this module would welcome any fix you can provide!

pYr0x commented 6 years ago

i have made a demo https://github.com/pYr0x/express-gzip even on that simple example, chrome and other browers dont show the Content-Encoding.

if i visit other global website e.g. https://www.nytimes.com/ i see a content-encoding: gzip so a bug in chrome can be excluded.

the only difference on the respone headers i found is that:

can Transfer-Encoding: chunked be the reason why the Content-Encoding is not shown or ignored by chrome?

@dougwilson is the demo shown you the Content-Encoding? i am on windows 10 with chrome 67.0.3396.79

dougwilson commented 6 years ago

Thanks for providing a repo! I an getting Content-Encoding: gzip in the Chrome Console just as I would expect from your project: image

pYr0x commented 6 years ago

you are on windows right? what node and npm version do you have installed?

dougwilson commented 6 years ago

Yes, I am on Windows 10. I used Node.js 8.11.2 (installed fresh just for this) so we would be using the exact same Node.js to try and keep every as similar as possible from what you said so far.

pYr0x commented 6 years ago

So I have no glue what’s going on... :(

dougwilson commented 6 years ago

Same. Variations of this issue have been report many times but either it suddenly started working and the reported doesn't know why or I had to close due to no further progress. If I could reproduce it I could try to track it down, otherwise since you can reproduce it we're all awaiting to hear what the issue is that you're having and where the bug is located.

pYr0x commented 6 years ago

ok one last try:

dougwilson commented 6 years ago

Hi @pYr0x sorry I didn't get back to you earlier. I just tried out your additional suggestions and everything is still working fine for me.

I did the following:

  1. Installed a brand new Windows 10 on an old machine.
  2. Installed a new copy of Google Chrome
  3. Installed a fresh copy of Node.js
  4. Ran the code I posted above and opened Chrome

This means that nothing I had on my machine before was preset. There were no extensions in Chrome now, as it's a fresh install on a fresh Windows 10 install.

The file size that Chrome is showing with gzip is 87.9 kb.

dougwilson commented 6 years ago

Closing stale issue.