Skip to content

Manage CDN cache TTL from proxito #10035

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

Open
stsewd opened this issue Feb 15, 2023 · 3 comments
Open

Manage CDN cache TTL from proxito #10035

stsewd opened this issue Feb 15, 2023 · 3 comments

Comments

@stsewd
Copy link
Member

stsewd commented Feb 15, 2023

Currently we are using CloudFlare's default, which isn't really explicit about the default value... but looks like it's 1 or 2 hours.

We already control caching level using the CDN-Cache-Control header (private vs public), that same header accepts the max-age directive to indicate the TTL for the edge cache

header = "CDN-Cache-Control"

https://developers.cloudflare.com/cache/about/cdn-cache-control

User feedback

We also had a user who wanted the ability to set different TTL's for files based on version:

Just ran across this issue, and thanks for dropping the TTL. I got bit by this because we serve JSON resources on our site and Deno respects the Cache-Control max-age when loading Javascript or JSON documents from the internet. Days or even months is fine for our versioned docs, as we will almost never rebuild, but /en/latest/ is useful to have on the order of 5-30 minutes.

Could be interested as an advanced user feature, or just something we set in the admin via support 🤔

This is similar to what we do with sitemaps: https://docs.readthedocs.io/en/stable/reference/sitemaps.html#how-it-works

@ericholscher
Copy link
Member

We also talked about more aggressively caching fonts and static files, since they generally have hashes. Also they don't really change too frequently, so a missed cache invalidation isn't a huge deal.

@ericholscher
Copy link
Member

header = "CDN-Cache-Control"

This should probably be cache_header = :)

@stsewd
Copy link
Member Author

stsewd commented Mar 1, 2023

Some ideas of how to make this configurable per view #10067 (comment)

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

No branches or pull requests

2 participants