Comments (11)
Hi! This module is a no-op on HEAD
requests--we even have a test for this: https://github.com/expressjs/compression/blob/master/test/test.js#L22
Please let me know what version of this module you are using, what version of Node.js and a full reproducable test case (you can always edit our test file if you're not sure how to provide a test case).
from compression.
From your stack trace, if you really did get a HEAD
request, you may want to verify something in your code base did not lower-casereq.method
value--it is only valid to be upper-case. The reason I say this is because your stack trace includes Express render
-> send
calls and those are operating as if it's not a HEAD
request, just like this module is.
from compression.
I create a test repo https://github.com/wlsy/compressionTest.git
npm install & npm start &node testHEAD.js
from compression.
I'm sorry, it doesn't reproduce for me:
Doug.wilson@IN5358 ~/test
$ git clone https://github.com/wlsy/compressionTest.git
Cloning into 'compressionTest'...
remote: Counting objects: 23, done.
remote: Compressing objects: 100% (16/16), done.
remote: Total 23 (delta 1), reused 23 (delta 1)
Unpacking objects: 100% (23/23), done.
Checking connectivity... done
Doug.wilson@IN5358 ~/test
$ cd compressionTest/
Doug.wilson@IN5358 ~/test/compressionTest (master)
$ npm install
[email protected] node_modules\cookie-parser
├── [email protected]
└── [email protected]
[email protected] node_modules\debug
└── [email protected]
[email protected] node_modules\morgan
├── [email protected]
├── [email protected]
└── [email protected] ([email protected])
[email protected] node_modules\serve-favicon
├── [email protected]
├── [email protected]
└── [email protected] ([email protected])
[email protected] node_modules\compression
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected])
├── [email protected] ([email protected])
└── [email protected] ([email protected], [email protected])
[email protected] node_modules\body-parser
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected])
├── [email protected]
├── [email protected]
└── [email protected] ([email protected])
[email protected] node_modules\request
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected])
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected], [email protected], [email protected])
└── [email protected] ([email protected], [email protected], [email protected], [email protected])
[email protected] node_modules\express
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected])
├── [email protected]
├── [email protected] ([email protected])
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected])
└── [email protected] ([email protected])
[email protected] node_modules\jade
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected])
├── [email protected] ([email protected], [email protected], [email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected])
└── [email protected] ([email protected])
Doug.wilson@IN5358 ~/test/compressionTest (master)
$ node testHEAD.js
head request done
Doug.wilson@IN5358 ~/test/compressionTest (master)
$ node -v
v0.11.14
And the window with the server running:
Doug.wilson@IN5358 ~/test/compressionTest (master)
$ npm start
> [email protected] start c:\Users\doug.wilson\test\compressionTest
> node ./bin/www
HEAD / 200 622.418 ms - 170
from compression.
I think it might be a bug on node 0.11.14, using 0.10 will be ok.
from compression.
As you can see in my logs above, I used 0.11.14, not 0.10.
from compression.
I had looked at it more since I posted me running your app on Node.js 0.11.14 above, and I haven't been able to reproduce the issue (yes, even on 0.11.14). Can you try a few things?
- Completely uninstall your Node.js 0.11.14 and reinstall it. Perhaps you have a messed up version or something?
- Try to reproduce it on a completely different machine with your repo.
- Use the official binary from Node.js: http://nodejs.org/dist/v0.11.14/ and see if it still happens.
from compression.
@wlsy I can reproduce it now. This is the reason I could not before: nodejs/node-v0.x-archive#8855
from compression.
Root issue is an Express 4.x bug. Follow along at expressjs/express#2467 :)
from compression.
There is also a change I'm going to make to this module that will also fit more in line with 0.11.14 changes.
from compression.
If you now upgrade to [email protected]
, you'll avoid the bug in Express and your code will no longer error.
from compression.
Related Issues (20)
- Setting Vary header although caching is disabled HOT 1
- "drain" event listener leak when using res.once("drain"); can't use res.removeListener("drain") HOT 3
- compresssion doesn't work ,the vue.txt is 2m HOT 2
- Content-Type: application/json; charset=utf-8 No effect HOT 2
- Question: Why this middleware HOT 2
- Corrupted compressed .js-files for Mac OS / Safari -clients HOT 11
- Is compression working when node server is running on a container? HOT 2
- middleware fails when the request has more than 1 values for accept-encoding header HOT 2
- Is compression result cached? HOT 1
- change Transfer-encoding HOT 1
- Why does the data size increase after compression HOT 1
- Force size to be a minimum... HOT 2
- Chunked encoding is broken after using this middleware HOT 1
- Using a current debug version HOT 1
- Deflate backwards HOT 7
- Compression instrumentation (before/after compression hooks) HOT 2
- Angular Not Compressing? HOT 2
- compression not working json payload HOT 6
- Crash when compressing characters like ū HOT 1
- Express returns a non-compliant HTTP/206 response when gzip is enabled HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from compression.