Nginx Gzip SSL

Posted by tobi — 02:13 PM Jul 25

We switched our production server farm to Nginx when we moved it to toronto a few months back and it has been working admirably well.

A few days ago we ran into an issue though. GZip compressed responses which were requested through SSL were cut off after 32kb which was problematic because our biggest js file compresses down to 62kb.

After some upgrading and experimentation the culprit was found to be the following config line:

gzip_buffers

  • syntax: gzip_buffers number size
  • default: gzip_buffers 4 4k/8k
  • context: http, server, location Assigns the number and the size of the buffers into which to store the compressed response. If unset, the size of one buffer is equal to the size of page, depending on platform this either 4K or 8K.

4 * 8kb == 32768bytes, exactly where the transfer was cut off when accounting for HTTP response header size.

Adjusting the config to gzip_buffers 16 8k; saves the day here.

Comments

Commenting are now closed…