Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Precompressed option for Caddy FileServer #237

Open
tanc opened this issue Jul 13, 2021 · 1 comment
Open

Precompressed option for Caddy FileServer #237

tanc opened this issue Jul 13, 2021 · 1 comment
Labels
feature New feature

Comments

@tanc
Copy link
Contributor

tanc commented Jul 13, 2021

A (hopefully) quick and easy feature request: Activate the precompressed option for the file_server directive in Caddy: https://caddyserver.com/docs/caddyfile/directives/file_server

Many frameworks allow the pre-compressing of static assets using Brotli and gzip and they are compiled out with [filename].br or similar extension. With Caddy's precompressed option its possible for Caddy to serve these instead of gzipping on the fly for improved performance.

I'm hoping its as easy as adding a line in https://github.com/getmeli/meli/blob/beta/server/src/caddy/definitions/handlers.d.ts#L111

The Caddy config should be:

file_server {
    precompressed br zstd gzip
}

This article explains it well: https://austindw.com/precompressed-assets-caddy/

What do you think?

@gempain gempain added the feature New feature label Jul 19, 2021
@gempain
Copy link
Contributor

gempain commented Jul 19, 2021

This is a great idea, seems easy to implement. Would you be up for a PR ? It should be around here:

// https://caddyserver.com/docs/json/apps/http/servers/routes/handle/encode/encodings/gzip/
// https://caddy.community/t/gzip-headers-when-using-encode-handler/11781
const gzipHandler = {
  handler: 'encode',
  encodings: {
    gzip: {},
  },
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature
Projects
None yet
Development

No branches or pull requests

2 participants