Skip to content

Allow for Caddyfile to implicitly set prefer value for encode directive #4150

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

Closed
polarathene opened this issue May 7, 2021 · 1 comment · Fixed by #4151
Closed

Allow for Caddyfile to implicitly set prefer value for encode directive #4150

polarathene opened this issue May 7, 2021 · 1 comment · Fixed by #4151
Labels
feature ⚙️ New feature or request
Milestone

Comments

@polarathene
Copy link

polarathene commented May 7, 2021

Creating an issue for a recent discussion on encode directive docs PR for upcoming 2.4 release.


Proposal

For a Caddyfile, encode.prefer could be set implicitly.

- encode zstd gzip {
-  prefer zstd gzip
- }
+ encode zstd gzip

That would be intuitive to the user and consistent with the new file_server.precompressed feature.

Justification

Without prefer, only the first supported client encoding is negotiated (often gzip).

Impact of implicit preference:

  • Backwards compatibility concern already applies to encode adopting sane defaults.
  • Consistency:
    • The new file_server.precompressed has implicit preference.
    • Minimizing config verbosity and good defaults are goals of Caddy.
  • Caddy vs Clients:
    • Caddy: Only zstd and gzip are officially supported (50% chance gzip remains preferred).
    • Browser: Not a single browser supports zstd officially.
    • Other clients: If gzip is supported it often took priority, even if unintentional (eg cURL).
@francislavoie francislavoie added the feature ⚙️ New feature or request label May 7, 2021
@francislavoie
Copy link
Member

/cc @ueffel

@mholt mholt added this to the v2.4.0 milestone May 10, 2021
francislavoie added a commit that referenced this issue May 10, 2021
Followup to #4150, #4151 /cc @ueffel @polarathene

After a bit of discussion with @mholt, we decided to remove `prefer` as a subdirective and just go with using the order implicitly always. Simpler config, simpler docs, etc.
francislavoie added a commit that referenced this issue May 10, 2021
Followup to #4150, #4151 /cc @ueffel @polarathene

After a bit of discussion with @mholt, we decided to remove `prefer` as a subdirective and just go with using the order implicitly always. Simpler config, simpler docs, etc.
mholt pushed a commit that referenced this issue May 10, 2021
Followup to #4150, #4151 /cc @ueffel @polarathene

After a bit of discussion with @mholt, we decided to remove `prefer` as a subdirective and just go with using the order implicitly always. Simpler config, simpler docs, etc.

Effectively changes 7776471 and reverts a small part of f35a7fa.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature ⚙️ New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants