feat: Cloudflare edge caching infrastructure for api.worldmonitor.app#471
Merged
feat: Cloudflare edge caching infrastructure for api.worldmonitor.app#471
Conversation
….app Route web production RPC traffic through api.worldmonitor.app via fetch interceptor (installWebApiRedirect). Add default Cache-Control headers (s-maxage=300, stale-while-revalidate=60) on GET 200 responses, with no-store override for real-time endpoints (vessel snapshot). Update CORS to allow GET method. Skip Vercel bot middleware for API subdomain using hostname check (non-spoofable, replacing CF-Ray header approach). Update desktop cloud fallback to route through api.worldmonitor.app.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
SebastienMelki
approved these changes
Feb 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
installWebApiRedirect) routes RPC traffic throughapi.worldmonitor.appon production web, enabling CF edge cachings-maxage=300, stale-while-revalidate=60), withno-storeoverride for real-time endpoints (vessel snapshot)GET, POST, OPTIONSmethods (needed for POST→GET migration in feat: convert 52 API endpoints from POST to GET for edge caching #468)api.worldmonitor.appby hostname check (non-spoofable, CF handles bot protection)api.worldmonitor.appfor edge caching benefitFiles changed
src/services/runtime.tsinstallWebApiRedirect(),DEFAULT_REMOTE_HOSTS→ api subdomain,APP_HOSTSupdatedsrc/main.tsinstallWebApiRedirect()after desktop fetch patchapi/[domain]/v1/[rpc].tsCache-Controlon GET 200,no-storefor real-time endpointsserver/cors.tsmiddleware.tsDepends on
Test plan
tsc --noEmitpassesworldmonitor.approute toapi.worldmonitor.app/api/pathsapi.worldmonitor.appcurl -vGET endpoint returnsCache-Control: public, s-maxage=300curl -vvessel snapshot returnsCache-Control: no-storeCache-ControlheaderGET, POST, OPTIONS