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

Hemant Bist hemantbist at gmail.com
Fri Mar 23 00:00:20 UTC 2018


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20180322/c1a19fc9/attachment.html>


More information about the nginx mailing list