Put Static Assets Near the Users Who Load Them
An app can be quick beside its origin and painful everywhere else. Every image, font, script, and stylesheet still has to cross the distance. A CDN helps when it can store public, versioned bytes at an edge near the user. It cannot rescue an uncacheable response or a private API call.
Start with an asset inventory
For each large first-screen request, record:
- URL, type, and transfer size;
- whether the filename changes when the content changes;
Cache-Control,ETag,Age, and CDN cache status;- origin region and test region;
- DNS, connection, wait, and download timing;
- whether the response contains user-specific data.
Only public, reusable content belongs in a shared CDN cache. Keep authenticated HTML, API responses, presigned URLs, and private documents out unless the caching design explicitly isolates users.
Use long caching safely
Content-hashed files can use a long lifetime:
Cache-Control: public, max-age=31536000, immutable
The URL changes with the bytes, so a cached old URL is still correct. HTML should normally revalidate or use a short lifetime because it points to the current asset names.
Avoid purging the entire CDN on every deploy. Versioned URLs remove most purge work and make a rollback possible because an older page can still load its matching assets.
Verify the edge did the work
Request the same asset twice from more than one user region. The first response may be a miss. The second should show a cache hit in the provider header and a lower wait time. If it remains a miss, inspect cookies, query strings, cache-control, vary headers, and provider rules.
Do not claim success from a fast local request. A developer in the origin region is the least useful CDN test.
Separate CDN from application latency
The CDN shortens delivery for cached files. It does not move your database beside your server or make a dynamic endpoint cheaper. Break the waterfall into static bytes and dynamic work so the right layer gets fixed.
Claude can turn timing exports and headers into a cacheability map. Code and network probes must prove the hit, region, and response identity.
Run the starter locally
npm test
npm run validate
npm run sample
Dry-run validates a fictional asset inventory and returns a proposed edge plan. The n8n workflow and Docker service do not change CDN configuration or purge a cache.