chore: reduce CDN cache max-age to 0 seconds#2567
Conversation
📝 WalkthroughWalkthroughThis change updates ChangesDocumentation Cache Control Headers
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This PR adjusts CDN caching behavior for non-static /docs/* routes on Vercel by reducing the shared-cache TTL, allowing updates to propagate more quickly while retaining stale-while-revalidate behavior.
Changes:
- Reduce
s-maxagefrom 3600s to 300s for/docs/((?!assets/|img/|scripts/).*)responses. - Keep
stale-while-revalidate=604800unchanged for those responses.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@vercel.json`:
- Around line 1671-1675: The Cache-Control entries currently set s-maxage=0
which contradicts the PR intent to reduce CDN TTL to 300 seconds; update the
"value" fields for the "Cache-Control" and "CDN-Cache-Control" JSON objects (the
entries shown with keys "Cache-Control" and "CDN-Cache-Control") replacing
s-maxage=0 with s-maxage=300 so the header values become "public, s-maxage=300,
stale-while-revalidate=604800".
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 18f75528-6586-4bd0-ad47-a586c19b1122
📒 Files selected for processing (1)
vercel.json
| "value": "public, s-maxage=0, stale-while-revalidate=604800" | ||
| }, | ||
| { | ||
| "key": "CDN-Cache-Control", | ||
| "value": "public, s-maxage=3600, stale-while-revalidate=604800" | ||
| "value": "public, s-maxage=0, stale-while-revalidate=604800" |
There was a problem hiding this comment.
PR intent mismatch: s-maxage is 0 instead of 300.
Line 1671 and Line 1675 set CDN TTL to zero, which conflicts with the PR objective/title (“reduce ... to 300 seconds”). If the intent is 300 seconds, these values should be s-maxage=300 to avoid fully disabling fresh CDN caching.
Suggested fix
- "value": "public, s-maxage=0, stale-while-revalidate=604800"
+ "value": "public, s-maxage=300, stale-while-revalidate=604800"
...
- "value": "public, s-maxage=0, stale-while-revalidate=604800"
+ "value": "public, s-maxage=300, stale-while-revalidate=604800"📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| "value": "public, s-maxage=0, stale-while-revalidate=604800" | |
| }, | |
| { | |
| "key": "CDN-Cache-Control", | |
| "value": "public, s-maxage=3600, stale-while-revalidate=604800" | |
| "value": "public, s-maxage=0, stale-while-revalidate=604800" | |
| "value": "public, s-maxage=300, stale-while-revalidate=604800" | |
| }, | |
| { | |
| "key": "CDN-Cache-Control", | |
| "value": "public, s-maxage=300, stale-while-revalidate=604800" |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@vercel.json` around lines 1671 - 1675, The Cache-Control entries currently
set s-maxage=0 which contradicts the PR intent to reduce CDN TTL to 300 seconds;
update the "value" fields for the "Cache-Control" and "CDN-Cache-Control" JSON
objects (the entries shown with keys "Cache-Control" and "CDN-Cache-Control")
replacing s-maxage=0 with s-maxage=300 so the header values become "public,
s-maxage=300, stale-while-revalidate=604800".
Related Issue or Design Document
Checklist
If this pull request addresses a security vulnerability,
I confirm that I got approval (please contact security@ory.com) from the maintainers to push the changes.
Further comments
Summary by CodeRabbit