Skip to content

feat: Add Vercel CDN caching headers#6

Merged
cleptric merged 6 commits intomainfrom
feat/vercel-cdn-caching
Mar 9, 2026
Merged

feat: Add Vercel CDN caching headers#6
cleptric merged 6 commits intomainfrom
feat/vercel-cdn-caching

Conversation

@cleptric
Copy link
Member

@cleptric cleptric commented Mar 9, 2026

Summary

  • Add Vercel-CDN-Cache-Control header: cache at edge for 60s, stale-while-revalidate for 1h, stale-if-error for 1 day
  • Add Cache-Control: public, max-age=0, must-revalidate so browsers always revalidate with the CDN
  • Replaces the removed in-memory cache with edge caching via Vercel's CDN

Test plan

  • Deploy to Vercel preview and verify x-vercel-cache header shows HIT on repeated requests
  • Verify stale content is served when GitHub raw is slow/down

🤖 Generated with Claude Code

Agent transcript: https://claudescope.sentry.dev/share/w2TRhRncfsUWMEYQWt2e_fhCViqsFvH-APGEwffKWRM

cleptric added 2 commits March 9, 2026 14:39
Replace catch-all route with explicit route handlers for each endpoint.
Remove in-memory cache and stale-while-error logic in favor of direct
proxy pass-through. Add typed Context and ContentfulStatusCode imports.

Co-Authored-By: Claude <noreply@anthropic.com>

Agent transcript: https://claudescope.sentry.dev/share/4rxSgfqf_8e03QyKF2z9P75vink8hZ2eN_MRVyURJa4
Set Vercel-CDN-Cache-Control to cache responses at the edge for 60s,
serve stale while revalidating for 1 hour, and serve stale on error
for 1 day. Browser always revalidates with the CDN via Cache-Control
public, max-age=0, must-revalidate.

Co-Authored-By: Claude <noreply@anthropic.com>

Agent transcript: https://claudescope.sentry.dev/share/a5cSzprm1SagVeTqTLisTP11Tlat8d9yjFAPBn4jc-Q
@vercel
Copy link

vercel bot commented Mar 9, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
skills-sentry-dev Ready Ready Preview, Comment Mar 9, 2026 2:54pm

Request Review

Vercel's CDN caches non-200 responses when cache headers are present.
This caused 404s from upstream to be cached at the edge, delaying
access to newly available resources.

Co-Authored-By: Claude <noreply@anthropic.com>

Agent transcript: https://claudescope.sentry.dev/share/jYGJnrx7n6sHPFnlv-7WZMp27WUdStyc0RflubaFWwY
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

app.get("/skills/*", (c) => {
const url = new URL(c.req.url);
const canonicalPath = c.req.path.slice("/skills".length) || "/";
return c.redirect(`${canonicalPath}${url.search}`, 301);
Copy link

Choose a reason for hiding this comment

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

Open redirect via double-slash in /skills/* redirect

Medium Severity

The /skills/* handler computes canonicalPath by slicing the raw request path and uses it directly in c.redirect(). Hono does not normalize double slashes in paths (confirmed by honojs/hono#3034), so a request to /skills//evil.com produces canonicalPath of //evil.com. A redirect to //evil.com is interpreted by browsers as a protocol-relative URL, redirecting the user to evil.com. The canonicalPath value needs validation to prevent it from starting with //.

Fix in Cursor Fix in Web

Copy link
Member Author

Choose a reason for hiding this comment

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

Addressing this in a follow-up

@cleptric cleptric changed the base branch from refactor/simplify-proxy-handler to main March 9, 2026 14:54
@cleptric cleptric merged commit 0644baa into main Mar 9, 2026
5 checks passed
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

Successfully merging this pull request may close these issues.

1 participant