Prompt
How do I serve assets from edge locations near users?
Latest observation
Oct 12, 2026
OpenAI APIWeb search: off
To serve assets from edge locations near users, use a CDN (Content Delivery Network).
How it works
- You host your origin files (images, JS, CSS, videos, etc.) in one place, like object storage or your app server.
- A CDN copies or caches those assets at edge servers around the world.
- When a user requests a file, it’s delivered from the nearest edge location, which reduces latency and speeds up load times.
What you typically do
-
Put static assets on an origin
- Examples: S3, GCS, Azure Blob, or your own server.
-
Enable a CDN in front of it
- Examples: Cloudflare, AWS CloudFront, Fastly, Akamai, Bunny CDN.
-
Set cache headers
- Use
Cache-Controlfor long-lived static files, e.g.:Cache-Control: public, max-age=31536000, immutablefor versioned assets
- This helps edge caches keep files longer.
- Use
-
Use versioned filenames
- Example:
app.8f3a1c.js,styles.a12b.css - That lets you cache aggressively without worrying about stale content.
- Example:
-
Serve via the CDN domain
- Instead of
https://yourdomain.com/assets/app.js - Use
https://cdn.yourdomain.com/assets/app.js
- Instead of
If you mean “serve code from edge”
Some platforms let you run logic at the edge too:
- Cloudflare Workers
- Fastly Compute
- Vercel Edge Functions
- AWS Lambda@Edge
That’s useful for personalization, routing, or A/B tests, but for plain assets, a CDN is the standard solution.
If you want, I can show you how to set this up on Cloudflare, AWS CloudFront, or Nginx + CDN.