breezewish / express-minify

Automatically minify and cache your javascript and css files.
https://npmjs.org/package/express-minify
MIT License
86 stars 18 forks source link

Does not work well with the compression module #16

Closed IngwiePhoenix closed 8 years ago

IngwiePhoenix commented 9 years ago

Hey there. I keep getting ERR_CONTENT_DECODING_FAILED messages from chrome while using this one and the compression module together.

When I use cURL to look at the output, it looks perfectly right; but requesting this with the browser results in the above error.

Here is a snapshot of using CURL to get the file. Its a static asset generated by a different tool.

Ingwie@Ingwies-Macbook-Pro.local ~/Work/BIRD3 $ curl -v -4 --header "Accept-encoding: gzip" http://localhost:8080/cdn/assets/f9f74164/c_ce8e14622a9666575efec15f9f44009c.css > test.gz
* Hostname was NOT found in DNS cache
*   Trying 127.0.0.1...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* Connected to localhost (127.0.0.1) port 8080 (#0)
> GET /cdn/assets/f9f74164/c_ce8e14622a9666575efec15f9f44009c.css HTTP/1.1
> User-Agent: curl/7.38.0
> Host: localhost:8080
> Accept: */*
> Accept-encoding: gzip
>
< HTTP/1.1 200 OK
< Content-Type: text/css
< Cache-Control: max-age=0, must-revalidate
< ETag: 5/bNP6Ea/OG8UdvgX7sNWTIklPY=
< Content-Encoding: gzip
< Vary: Accept-Encoding
< X-Response-Time: 0.163ms
< Date: Thu, 15 Jan 2015 21:15:46 GMT
< Connection: keep-alive
< Transfer-Encoding: chunked
<
{ [data not shown]
100 87193    0 87193    0     0  28.7M      0 --:--:-- --:--:-- --:--:-- 83.1M
* Connection #0 to host localhost left intact
Ingwie@Ingwies-Macbook-Pro.local ~/Work/BIRD3 $ hexdump -C -n 16 test.gz
00000000  1f ef bf bd 08 00 00 00  00 00 00 03 ef bf bd ef  |................|
00000010
breezewish commented 9 years ago

Hello, what's your middleware order?

It should be

app.use(compression());
app.use(minify());
IngwiePhoenix commented 9 years ago

That is the very order. Here is the file, maybe you see soemthing then: http://git.ingwie.me/ingwie/bird3/blob/master/lib/request_handler.js http://git.ingwie.me/ingwie/bird3/blob/master/lib/request_handler.js

Am 17.01.2015 um 10:39 schrieb SummerWish notifications@github.com:

Hello, what's your middleware order?

It should be

app.use(compression()); app.use(minify()); — Reply to this email directly or view it on GitHub https://github.com/breeswish/express-minify/issues/16#issuecomment-70360790.

breezewish commented 8 years ago

Clean up old issues. If the issue still exists, please comment here.