Welcome! Log In Create A New Profile

Advanced

Is it possible for nginx to decompress FILES on-the-fly (not proxied)?

J.R.
February 29, 2020 09:46AM
I did a lot of googling and only came up with answers from many years
ago, or unanswered questions. Maybe I'm just not using the right
search keywords, so I figured I would ask the following....

Here's my scenario... I have a bunch of static html files that would
be served directly via nginx.

Is it possible to gzip them all, storing ONLY the compressed version
and have everything work as expected?

I've done some experimenting and I'm coming up short getting things to work...

I am using the following directives (skipping non-relevant), and yes
the extra modules were compiled in:

gzip on;
gzip_static on;
gunzip on;

If I make a request and allow compression, then it reads from the .gz
file no problem. If I make a request without allowing compression,
then I get a "file not found"...

I've tried with & without "try_files". Also if I append something
like "$uri.gz" to try files, then it sends the compressed file as-is
(what should be decompressed on the client side is still compressed).

I would hate to have to add a wrapper script and complicate things
just to accommodate that 1% that might request the data
uncompressed...

From what I can gather reading over the gunzip source, it appears that
decompression is only for when it's proxying (decompress the upstream
response).

Even if there's a non-standard patch available, I have no issues
recompiling to get this to work.
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Is it possible for nginx to decompress FILES on-the-fly (not proxied)?

J.R. February 29, 2020 09:46AM

Re: Is it possible for nginx to decompress FILES on-the-fly (not proxied)?

J.R. February 29, 2020 10:32AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 73
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