I'm using Amazon S3 to serve static files. When the Content-Type is just 'text/css' and I haven't compressed the file, it is returned ok. If I try to zlib.compress() the contents that will be returned and change Content-Encoding to 'gzip', the browser cannot decode the result. In Chrome, the error is
Error 330 net::ERR_CONTENT_DECODING_FAILED
in Safari,
“cannot decode raw data” (NSURLErrorDomain:-1015)
Is there something special to do with python's zlib to make sure the result can be returned and decompressed by the browser?
I have this same problem.
If you send the header:
Content-Encoding: gzip
Safari/Chrome show that error.
But if you instead send:
Content-Encoding: deflate
Safari/Chrome decodes the input fine.
gzip is not the same as zlib.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With