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

encode: Compress more media types by default #6081

Merged
merged 4 commits into from
Feb 9, 2024

Conversation

dunglas
Copy link
Collaborator

@dunglas dunglas commented Feb 4, 2024

Add all media types supported by Cloudflare to the default list of compressed media types.

This fixes a problem reported by @pborreli: by default JSON-LD responses generated by API Platform aren't compressed.

I've kept Atom, which isn't supported by Cloudflare but is in our existing list (other existing values are also in Cloudflare's list).
I've kept the strategy of adding a wildcard at the end of each of the values (to allow all parameters, I suppose), but this may be too permissive. If we keep the wildcards, I wonder if building a regex wouldn't be faster than the current iteration. I'll try this and open another PR in the next few weeks if it improves performance.

Copy link
Member

@mholt mholt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, thanks!

Sounds good to me; let's keep it simple for now, it should still be quite fast.

@francislavoie francislavoie added the bug 🐞 Something isn't working label Feb 5, 2024
@francislavoie francislavoie added this to the v2.8.0 milestone Feb 5, 2024
@francislavoie francislavoie changed the title fix: add more media types to the compressed by default list encode: Compress more media types by default Feb 5, 2024
@dunglas dunglas enabled auto-merge February 9, 2024 08:36
@dunglas dunglas merged commit a6d9f9b into caddyserver:master Feb 9, 2024
25 checks passed
@dunglas dunglas deleted the fix/encode-match branch July 3, 2024 09:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐞 Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants