Skip to content

feat: enable Cloudflare edge caching#212

Open
MarshallOfSound wants to merge 1 commit intomainfrom
sam/public-cache-headers
Open

feat: enable Cloudflare edge caching#212
MarshallOfSound wants to merge 1 commit intomainfrom
sam/public-cache-headers

Conversation

@MarshallOfSound
Copy link
Member

Summary

  • Change all route Cache-Control headers from private to public with s-maxage and stale-while-revalidate to enable Cloudflare edge caching
  • Fix timezone GeoIP detection to use CF-Connecting-IP (real client IP) instead of the last x-forwarded-for entry (which would be Cloudflare's edge IP)

Context

All routes serve public Electron release data with no user-specific content — the only per-user variance is timezone, which is handled by including the tz cookie and user geo in the Cloudflare cache key (see electron/infra#195).

Cache TTLs

Routes Browser max-age Edge s-maxage stale-while-revalidate
Home, All Releases, Build Job 30s 30s 60s
PR Lookup, PR Details 60s 120s 60s
History, Schedule 120s 300s 120s
Single Release, Compare 300s 600s 300s

🤖 Generated with Claude Code

Change all route Cache-Control headers from `private` to `public` with
`s-maxage` and `stale-while-revalidate` to allow Cloudflare to cache
responses at the edge. All routes serve public Electron release data
with no user-specific content, so this is safe.

Also fix timezone detection for Cloudflare proxying:
- Prefer CF-Connecting-IP (real client IP) over x-forwarded-for
- Use first IP in x-forwarded-for (originating client) not last (proxy)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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