Gzip issue with Safari

Francis Daly francis at daoine.org
Wed May 18 17:04:25 UTC 2016

On Wed, May 18, 2016 at 03:37:51AM -0400, mcofko wrote:

Hi there,

> enabled gziping on nginx and it's working on Chrome perfectly (we know this
> looking at network tab in developer tools, where we can see the size of the
> gzipped file one.dds that needed to be downloaded and it's around 2MB while
> the original one.dds filesize is around 4MB).

I think this means that you can see the http request that Chrome makes,
and you can see the response that nginx gives, and that they are what
you want.

Can you use "curl" to make the same request, and see the same
response? That usually makes it easier to see what exactly is going on,
because there are fewer layers in the way.

(I'm not sure whether your nginx is serving the content of the file
one.dds.gz as-is, or is serving the content of the file one.dds and
gzip'ing it on-the-fly. Maybe it makes a difference; maybe it doesn't.)

> I also checkede the header of
> the file, and Accept-Encoding has values GZIP, deflate, sdch.

I think that that refers to the http request header; with luck you
will be able to reproduce that in curl, where the full communication
can be copy-paste'd.

> But the same file loaded on iMac with Safari browser takes/loads 4MB, which
> clearly states that the Safari somehow doesn't accept or ignores files with
> .gz extension. I also checked file header and Accept-Encoding has: GZIP,
> deflate.

Can you see the differences between the request that Chrome made and
the request that Safari made? That might indicate why nginx gave different

If you can re-create both requests in curl you'll be able to see the
different responses from your nginx, and maybe that will give you a hint
as to where the problem is.

> The same problems were already reported on some other forums, but they were
> able to solve the problem, because they're using Apache, which enables
> adding options as: 
> AddEncoding gzip .jsz
> AddType text/javascript .jsz

I don't see those other forums you mention.

I don't see that those options will make a difference unless you are
actually requesting /one.jsz or /one.dds.jsz. But perhaps there are
extra things happening in the apache config that makes things work.

nginx does have an add_header directive to add general headers; and has
a types directive to set one header based on filename extension.

It may be that some combination of those could help you; but I suspect
that the full answer will be different.

> I hope this links will help you understand my problem:
> http://blog.bigsmoke.us/2012/01/16/safari-ignores-content-type-for-gz-suffix
> http://stackoverflow.com/questions/962721/pre-compressed-gzip-break-on-chrome-why

They seem to say that you shouldn't ask Safari to request /one.js.gz if
you want Safari to use the response as a script.

That doesn't seem related to the rest of your email.

I suspect I'm missing something.

And I still don't know what request you make, what response you get,
or what response you want. So I'll let someone else get involved.


Francis Daly        francis at daoine.org

More information about the nginx mailing list