lemmy
lemmy copied to clipboard
Add setting to mark paths varying by accept header as uncacheable
Requirements
- [x] Is this a feature request? For questions or discussions use https://lemmy.ml/c/lemmy_support or the matrix chat.
- [x] Did you check to see if this issue already exists?
- [x] Is this only a feature request? Do not put multiple feature requests in one issue.
- [x] Is this a backend issue? Use the lemmy-ui repo for UI / frontend issues.
- [x] Do you agree to follow the rules in our Code of Conduct?
Is your proposal related to a problem?
As mentioned in #5632, various CDNs/caches don't support (as in ignore) the Vary header.
As a result, instance operators using a cache ignoring the vary header are required to do one of the following:
- disable caching entirely
- set up custom cache rules to disable caching for paths used by both Lemmy and Lemmy-UI
- set up custom cache keys if supported (Cloudflare locks this behind their enterprise plan)
Describe the solution you'd like.
To simplify setups, Lemmy should have an option to explicitly mark paths used by both Lemmy and Lemmy-UI with cache-control: private, similar to how responses for authenticated users are treated.
This should not affect URLs that are exclusive to either Lemmy or Lemmy-UI, like pict-rs URLs.
Describe alternatives you've considered.
- disable caching entirely
- set up custom cache rules to disable caching for paths used by both Lemmy and Lemmy-UI
- set up custom cache keys if supported (Cloudflare locks this behind their enterprise plan)
Additional context
Related:
- #5632
- https://github.com/LemmyNet/lemmy-ui/issues/3099
- https://github.com/LemmyNet/lemmy-ui/issues/3100
Im not sure if its worth to add an extra setting for this, we could remove caching for these endpoints to keep it simple.