CDN for Node.js
Keep Node busy with application work, not CSS.
Express, Fastify and other Node servers often stream the same assets and public JSON from the same process that handles application logic.
Put Cloud CDN in front of the Node origin. Cache static middleware output and public GET JSON. Bypass authenticated APIs and POST.
Why teams use Aptranet
What CDN for Node.js looks like on this network.
Cloud CDN caches and accelerates eligible content on 210+ points of presence, with Origin Shield when the origin must stay out of the way.
Static middleware at the edge
express.static and similar output is cached on 210+ PoPs.
Public GET JSON from cache
Identical API GETs can be stored at the edge with a TTL you choose.
Origin Shield for Node
Miss storms are consolidated before they hit a small Node cluster.
How to set it up
A cutover you can validate before DNS moves.
Create the Cloud CDN configuration, prove it on an Aptranet hostname, then point production DNS when the path looks correct.
- 1Front the Node listen port with Cloud CDN
Pull HTTPS from a reverse proxy in front of Node, or TLS at the origin.
- 2Cache static routes first
Start with /public, /assets and hashed front-end files.
- 3Add cacheable API GETs
Only responses that are identical for every anonymous client.
- 4Bypass the rest
WebSockets, POST, and authenticated JSON stay on Node. See CDN for WebSockets.
Outcomes
What changes once the hostname is on Aptranet.
- Node static files are cached globally
- Public GET APIs can be cached
- Authenticated APIs remain dynamic
- Origin Shield protects small clusters
Keep reading
Related pages
More CDN use cases on the same Cloud CDN footprint.
Frequently Asked Questions
Yes. Cloud CDN fronts the HTTP origin, independent of the Node framework.
Cache anonymous HTML. Bypass render output that varies on cookies. See Next.js, Nuxt and Remix pages.
Cloud CDN can reuse origin validators. Prefer explicit TTLs plus purge for HTML.
Cloud CDN supports WebSockets for dynamic paths that bypass cache. See the WebSockets page.
