You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Basically, if the client asks for /styles.css while indicating in Accept-Encoding that it's willing to accept gzip and there's /styles.css.gz file on disk, the server takes this .gz file and serves it to the client with a corresponding Content-Encoding header.
Perhaps this could be done in an encoding-agnostic way?
I'd think of it something like encoding "gzip" suffix ".gz" would do so with gzip, although you could also do encoding "compress" suffix ".lzma" for example.
IMHO any directives aren't needed and it's better to have a file names convention to keep httpd plain. When GET /some_file.txt can just check if there is a /some_file.txt.gz or /some_file.txt.br and return it's content. Other compression algorithms (LZ4, deflate) doesn't make any sense for pre-compresses files. Only Opera browser supports LZMA and maybe in future zstd will be supported by browsers.
Even if user do want to get the /some_file.txt.gz archive itself it still can get it because there is no /some_file.txt.gz.gz in the same folder.
Activity
clarfonthey commentedon Dec 8, 2019
Perhaps this could be done in an encoding-agnostic way?
I'd think of it something like
encoding "gzip" suffix ".gz"would do so with gzip, although you could also doencoding "compress" suffix ".lzma"for example.anatoli26 commentedon Dec 9, 2019
Good idea. There could be multiple directives for this functionality, like
gzip_static on,lzma_static on, etc.hucste commentedon May 8, 2020
And too, about precompressed static files with brotli.
stokito commentedon Sep 6, 2021
IMHO any directives aren't needed and it's better to have a file names convention to keep httpd plain. When
GET /some_file.txtcan just check if there is a/some_file.txt.gzor/some_file.txt.brand return it's content. Other compression algorithms (LZ4, deflate) doesn't make any sense for pre-compresses files. Only Opera browser supports LZMA and maybe in future zstd will be supported by browsers.Even if user do want to get the
/some_file.txt.gzarchive itself it still can get it because there is no/some_file.txt.gz.gzin the same folder.Such approach is used in BusyBox htttpd.