How can I disable Nginx double gzip encoding when the backcgi backcgi sometimes serves gzipped with content encoding?

Is there some clever way to trick nginx into stopping gzip if the backend has already set the "content-encoding" header?

Nginx is configured to gzip output from php fastcgi backend.

This works great 99% of the time.

Except in a rare case, php will send the raw gzip file and add the header Content-Encoding: gzip

.

Nginx will unfortunately go straight ahead and try to gzip that content a second time.

Creates a double header Content-Encoding: gzip

Content-Encoding: gzip

and a double-encoded gzipped body.

Most modern browsers can handle this, Firefox, Chrome.

IE8 cannot, Safari mobile cannot, old Safari 5 for Windows cannot - they will instead show garbled gzipped content because it concatenates the content encoding headers and only decodes the gzipped body once.

Thanks for any ideas.

+3


source to share


1 answer


Somewhere in nginx.conf where it is applied (there should be a fastcgi_params file there):

fastcgi_param  HTTP_ACCEPT_ENCODING      "";

      



This will disable encoding from the backend.

I hope that after this Nginx will serve encoded content. (I'm not sure)

0


source







All Articles