Wednesday, May 17, 2017

Safari not passing accept-encoding:gzip, deflate

Leave a Comment

I am making requests to cloudfront CDN and seeing very frustrating behavior. In chrome and firefox, the request passed the proper accept-encoding:gzip, deflate header.

However, safari does not do this and thus gets the uncompressed version of the file. This is a simple script tag in an HTML document. So I can't set the headers.

the same doc produces a request with the following header/browser combos

Safari headers

-H 'Cache-Control: max-age=0' \ -H 'If-Modified-Since: Mon, 08 May 2017 18:01:40 GMT' \ '

Chrome Headers

:method:GET :path:/main-b54b8739d65dfbd36152.js :scheme:https accept:/ accept-encoding:gzip, deflate, sdch, br accept-language:en-US,en;q=0.8 cache-control:no-cache pragma:no-cache

Also, the respective web inspectors provides additional information, in safari,Safari Screen shot

And in chrome, enter image description here

Additionally, the request takes 3 times longer in safari. 55ms in chrome and 150ms in safari, roughly.

I left out some info to protect my privacy. Thanks for the help!

1 Answers

Answers 1

Safari uses a different naming convention in their developer tools, which is consistent with your observations. Citing from this answer,

[1] Encoded = uncompressed filesize, from server [2] Decoded = uncompressed filesize, locally [3] Transferred = uncompressed file size + headers sent and received [4] Content-Length = compressed file sent, from server 

Please check the content-length property to see if it's really compressed.

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment