Nginx 0.5.33 + SSL + gzip = corrupt data (on large files)

Nginx Logo

First off, I love Nginx—It is by far, the best web-server I have ever used.

I came across a bug recently which really caused me to scratch my head. It took me a couple days just to isolate the issue and then I couldn't find anyone who wrote about it—so that's what I'm doing here.

The problem:
On one particular javascript file I could never download the whole thing.

This file was the concatenated version of about 8 files totaling near a megabyte. Turning on gzip compression helped significantly: 1mb turned into just over 250k. One caveat though, was that this file would need to be accessed in both HTTP and HTTPS.

Here-in lies the problem—over HTTPS (and only over HTTPS) the file would truncate about 3/4 of the way through, leaving all sorts of broken code in the wake. Always at the same spot, and always in SSL—but only that one file.

The Solution:
To test my theory, I cloned my server and upgraded to the newest stable version of nginx. I also figured it was a good time since there are a number of security fixes and I was only using the legacy version because Ubuntu had an easy installer for it.

Needless to say upgrading Nginx to 0.6.36 took care of the issue as well as patched up those nasty security holes.

  • Jonas

    I just spent a day struggling with this. Thanks for the tip!

  • Jonas

    I just spent a day struggling with this. Thanks for the tip!