feat(proxy): add Cloudflare edge caching for proxy.worldmonitor.app#478
Merged
Conversation
Add CDN-Cache-Control headers to all proxy endpoints so Cloudflare can cache responses at the edge independently of browser Cache-Control: - RSS: 600s edge + stale-while-revalidate=300 (browser: 300s) - UCDP: 3600s edge (matches browser) - OpenSky: 15s edge (browser: 30s) for fresher flight data - WorldBank: 1800s/86400s edge (matches browser) - Polymarket: 120s edge (matches browser) - Telegram: 10s edge (matches browser) - AIS snapshot: 2s edge (matches browser) Also fixes: - Vary header merging: sendCompressed/sendPreGzipped now merge existing Vary: Origin instead of overwriting, preventing cross-origin cache poisoning at the edge - Stale fallback responses (OpenSky, WorldBank, Polymarket, RSS) now set Cache-Control: no-store + CDN-Cache-Control: no-store to prevent edge caching of degraded responses - All no-cache branches get CDN-Cache-Control: no-store - /opensky-reset gets no-store (state-changing endpoint)
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
koala73
added a commit
that referenced
this pull request
Mar 1, 2026
…478) Add CDN-Cache-Control headers to all proxy endpoints so Cloudflare can cache responses at the edge independently of browser Cache-Control: - RSS: 600s edge + stale-while-revalidate=300 (browser: 300s) - UCDP: 3600s edge (matches browser) - OpenSky: 15s edge (browser: 30s) for fresher flight data - WorldBank: 1800s/86400s edge (matches browser) - Polymarket: 120s edge (matches browser) - Telegram: 10s edge (matches browser) - AIS snapshot: 2s edge (matches browser) Also fixes: - Vary header merging: sendCompressed/sendPreGzipped now merge existing Vary: Origin instead of overwriting, preventing cross-origin cache poisoning at the edge - Stale fallback responses (OpenSky, WorldBank, Polymarket, RSS) now set Cache-Control: no-store + CDN-Cache-Control: no-store to prevent edge caching of degraded responses - All no-cache branches get CDN-Cache-Control: no-store - /opensky-reset gets no-store (state-changing endpoint)
Summary
CDN-Cache-Controlheaders to all proxy endpoints (/rss,/ucdp-events,/opensky,/worldbank,/polymarket,/telegram,/ais/snapshot) enabling Cloudflare edge caching independently of browserCache-ControlVaryheader merging insendCompressed/sendPreGzipped— was overwritingVary: OriginwithVary: Accept-Encoding, now properly merges both to prevent cross-origin cache poisoningCache-Control: no-store+CDN-Cache-Control: no-storeto all stale fallback and error responses to prevent edge caching of degraded dataEdge TTLs
/rss/ucdp-events/opensky/worldbank(data)/worldbank(indicators)/polymarket/telegram/ais/snapshotCloudflare Dashboard (manual post-deploy)
Create a Cache Rule for
proxy.worldmonitor.app:proxy.worldmonitor.app+ URI path in allowlist (/rss,/ucdp-events,/worldbank,/polymarket,/telegram,/opensky,/ais/snapshot)/opensky-reset,/opensky-diagCDN-Cache-ControlTest plan
CDN-Cache-Controlheader present on authenticated requestscf-cache-status: HITon second request after Cloudflare Cache Rule is activeno-store(not edge-cached)/opensky-resetand/opensky-diagare not edge-cachedVaryheader includes bothOriginandAccept-Encoding