CDN for Gatsby
Gatsby generates the files. Cloud CDN places them next to readers.
Gatsby SSG output is static, but hosting it in one region still leaves HTML, JS and image slices far from most visitors.
Pull the Gatsby public/ output through Cloud CDN. Cache hashed assets for a long time, purge HTML on each build, and optionally transform images at the edge.
Why teams use Aptranet
What CDN for Gatsby 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.
public/ at 210+ locations
HTML, page-data JSON and bundles are served with 30 ms average latency.
Slice images without origin work
Cache Gatsby image output or replace some derivatives with edge transforms.
Build-time purge
Each Gatsby build can purge HTML so new pages go live immediately.
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.
- 1Host the Gatsby public directory
Use any HTTPS origin Cloud CDN can pull — a files host or a static host.
- 2Cache hashed files longer
Page-data and HTML get purgeable TTLs. Fingerprinted JS/CSS can live longer.
- 3Purge on CI
After gatsby build, purge HTML and page-data paths.
- 4Attach the domain
Map TLS and DNS once a test hostname is correct.
Outcomes
What changes once the hostname is on Aptranet.
- Gatsby sites are delivered globally
- CI can purge on every build
- Images are cached at the edge
- The origin is only needed on misses
Keep reading
Related pages
More CDN use cases on the same Cloud CDN footprint.
Frequently Asked Questions
Yes. Cache the generated files. You can also serve some sizes via Cloud CDN image optimization.
Cache static routes. DSG/SSR paths should only be cached when the HTML is shareable.
Any HTTPS origin that serves the Gatsby build. Cloud CDN does not require a specific static host.
The shell HTML can be cached. Authenticated API calls from those routes stay dynamic.
