Welcome! Log In Create A New Profile

Advanced

Only compressed version of file on server , and supporting clients that don't send Accept-Encoding.

Hemant Bist
March 22, 2018 08:02PM
Hi,
We have only gzipped files stored on nginx and need to serve client that :
A) Support gzip transfer encoding (> 99% of the clients). They send
Accept-Encoding: gzip header...
B) < 1% of the clients that don't support transfer encoding. The don't send
Accept-Encoding header.

There is ample CPU in the nginx servers to support clients of type B). But
I am unable to figure out a config/reasonable script
to help us serve these clients.

Clients of type A) are served with the following config.
--- Working config that appends .gz in the try_files ----
location /compressed_files/ {
add_header Content-Encoding "gzip";
expires 48h;
add_header Cache-Control private;
try_files $uri.gz @lua_script_for_missing_file;
}


----- Not working config with gunzip on; likely because gunzip filter
runs before add_header?

location /compressed_files/ {
add_header Content-Encoding "gzip";

expires 48h;
add_header Cache-Control private;
*# gunzip on fails to uncompress likely because it does not notice the
add_header directive.*
* gunzip on;*
* gzip_proxied any;*
try_files $uri.gz @lua_script_for_missing_file;
}


I would appreciate any pointers on how to do this. I may be missing some
obvious configuration for such case.
We did discuss keeping both unzipped and zipped version on the server, but
unfortunately that is unlikely to happen.

Thanks,
Hemant
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Only compressed version of file on server , and supporting clients that don't send Accept-Encoding.

Hemant Bist March 22, 2018 08:02PM

Re: Only compressed version of file on server , and supporting clients that don't send Accept-Encoding.

Maxim Dounin March 22, 2018 08:40PM

Re: Only compressed version of file on server , and supporting clients that don't send Accept-Encoding.

Hemant Bist March 23, 2018 02:00PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 105
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready