Welcome! Log In Create A New Profile

Advanced

serve precompressed files without also serving their uncompressed counterparts

December 22, 2015 11:01AM
Hi,

Is it possible to serve precompressed files without serving their uncompressed counterparts?

For example:
/var/www/ contains index.html.gz, but no index.html. How do I configure nginx to respond with index.html.gz when the client supports gzip or let nginx decompress the file on the fly when the client does not support gzip?

Based on this answer on stackoverflow http://serverfault.com/a/611757, I am currently using the following configuration:

location / {
try_files $uri $uri/ @application;
root /var/www;
gzip_static on;
gunzip on;
}

@application configures the application server.
When I try get the index.html page, nginx return a 403 forbidden error.
Subject Author Posted

serve precompressed files without also serving their uncompressed counterparts

snieuwen December 22, 2015 11:01AM

Re: serve precompressed files without also serving their uncompressed counterparts

Valentin V. Bartenev December 22, 2015 11:06AM

Re: serve precompressed files without also serving their uncompressed counterparts

Valentin V. Bartenev December 22, 2015 11:16AM

Re: serve precompressed files without also serving their uncompressed counterparts

Maxim Dounin December 22, 2015 11:26AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 300
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready