Skip to content

chore: reduce CDN cache max-age to 0 seconds#2567

Open
jaygiang wants to merge 2 commits into
masterfrom
chore/reduce-maxage-cdn-cache
Open

chore: reduce CDN cache max-age to 0 seconds#2567
jaygiang wants to merge 2 commits into
masterfrom
chore/reduce-maxage-cdn-cache

Conversation

@jaygiang
Copy link
Copy Markdown
Collaborator

@jaygiang jaygiang commented May 20, 2026

Related Issue or Design Document

Checklist

  • I have read the contributing guidelines and signed the CLA.
  • I have referenced an issue containing the design document if my change introduces a new feature.
  • I have read the security policy.
  • I confirm that this pull request does not address a security vulnerability.
    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.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added the necessary documentation within the code base (if appropriate).

Further comments

Summary by CodeRabbit

  • Chores
    • Adjusted caching for documentation routes to set CDN short-term caching to zero while retaining stale-while-revalidate, so documentation updates appear faster without disrupting background revalidation.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 20, 2026

📝 Walkthrough

Walkthrough

This change updates vercel.json so the /docs/ route matcher (excluding assets/, img/, scripts/) sets Vercel-CDN-Cache-Control and CDN-Cache-Control to s-maxage=0, preserving stale-while-revalidate=604800 and public; asset routes unchanged.

Changes

Documentation Cache Control Headers

Layer / File(s) Summary
CDN cache configuration
vercel.json
s-maxage for the non-asset /docs/ matcher is changed to 0 in both Vercel-CDN-Cache-Control and CDN-Cache-Control, preserving stale-while-revalidate=604800 and public.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • ory/docs#2556: Modifies the same /docs/ route cache headers in vercel.json with updates to s-maxage values.

Suggested reviewers

  • aeneasr
  • zepatrik
  • wassimoo
  • piotrmsc
  • vinckr
  • unatasha8

Poem

🐰 I tweak the headers, gentle and spry,
s-maxage to zero so fresh docs fly,
stale can revalidate, patience kept near,
users get new words, CDN holds old dear,
hop—docs stay current, updates appear!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description contains only the standard template with no actual content—the author did not provide a description of changes, rationale, related issues, or any substantive information. Add a meaningful description explaining why the CDN cache max-age was reduced to 0 seconds and reference any related issue or design document.
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The PR title states 'reduce CDN cache max-age to 0 seconds', which matches the actual change in vercel.json where s-maxage was changed from 3600 to 0. The title accurately summarizes the main change.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/reduce-maxage-cdn-cache

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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-maxage from 3600s to 300s for /docs/((?!assets/|img/|scripts/).*) responses.
  • Keep stale-while-revalidate=604800 unchanged for those responses.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between b9bac4b and 613a2ff.

📒 Files selected for processing (1)
  • vercel.json

Comment thread vercel.json
Comment on lines +1671 to +1675
"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"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

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.

Suggested change
"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".

@jaygiang jaygiang changed the title chore: reduce CDN cache max-age to 300 seconds chore: reduce CDN cache max-age to 0 seconds May 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants