Skip to content

precompressed static files #80

Open

Description

@anatoli26

I know the answer about dynamic compression (#21). What about serving precompressed static files like the nginx 's gzip_static module (https://nginx.org/en/docs/http/ngx_http_gzip_static_module.html)?

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.

Activity

  1. clarfonthey commented on Dec 8, 2019

    @clarfonthey

    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.

  2. anatoli26 commented on Dec 9, 2019

    @anatoli26
    Author

    Perhaps this could be done in an encoding-agnostic way?

    Good idea. There could be multiple directives for this functionality, like gzip_static on, lzma_static on, etc.

  3. hucste commented on May 8, 2020

    @hucste

    And too, about precompressed static files with brotli.

  4. stokito commented on Sep 6, 2021

    @stokito

    There could be multiple directives

    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.

    Such approach is used in BusyBox htttpd.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions