Search code examples
httpsafarigzip

Why does Safari not accept GZIP compression?


I have a pretty big JavaScript file here which I want to embed into my website. The HTTP server is smart enough to GZIP the file before delivering it to the browser. However, I tested with Google Chrome and Safari. On Chrome, it works very well. 400K go down compressed to around 100k BUT on Safari compression doesn't work. The funny thing is that content-encoding is set to "gzip" correctly.


Update: I already read up on a GZIP-Bug in Safari where files cannot end on ".gz" or Safari won't accept GZIP. Since my file does not end on .gz this problem shouldn't be an issue.


Solution

  • The HTTP headers sent to Safari say it's compressed (It has the Content-Encoding: gzip header, and it says the Content-Length is 119406 bytes) - I'd trust those more than the bold number saying 430.61 in Web Inspector. How it determines both those numbers in the top column, , I don't know.

    You can get verification on how many bytes is going over the wire if you sniff the HTTP request with wireshark.