Sending pre-compressed data via nginx

Igor Sysoev is at
Thu Aug 31 09:11:04 MSD 2006

On Thu, 31 Aug 2006, Yusuf Goolamabbas wrote:

> Hi, I wasn't able to figure out if it's possible to send out
> precompressed (gzipped data) via nginx
> It just needs to add Content-Encoding: gzip to the response header
> I'm looking for something similar to what can be done in lighttpd

Currently it's easy to do only if you can easy separate locations:

      location / {
          root  /path/to/files;

      location ~* "(README|ChangeLog|\.txt)\.gz$" {
          root  /path/to/files;

          add_header  Content-Encoding  gzip;

          # turn off on the fly gzip compression, because
          # it does not currently check header set by "add_header"
          gzip off;

          # nginx set type according last suffix only
          type { text/plain gz }

Igor Sysoev

More information about the nginx mailing list