I have written a CSS server which does minimization and basic parsing/var replacement. The server is using node.js.
I am wanting to gzip my response from this server. As told in IRC, node.js does not currently have a gzip lib, so I am attempting to do it manually from the command line (as I am only gzipping when not in cache).
I am pushing the file data out to a temp file and then using exec to call 'gzip -c -9 -q ' + tempFile
. I get the compressed data back correctly (it seems), and send the proper Content-Encoding
header as 'gzip'
, but Chrome reports:
Error 330 (net::ERR_CONTENT_DECODING_FAILED): Unknown error
.
Also, some independent gzip testers online fail as well (not just Chrome).
I'm assuming this is something simple I do not know about generating gzip blocks for browsers, seeing as I have never tried to do it manually.
Any assistance would be helpful. The server is blazing fast, but I need to gzip the content to get the best performance for end users.
Thanks.
UPDATE
I have verified my Content-Length
is correct
Have you updated the Content-Length to match the gzipped size? It seems like that might screw up the decoding.