CDN for Astro

Cache Astro pages and their versioned assets with distinct lifetimes. Send server-rendered, personalized routes through to the application.

Example release policy
Versioned resource
/_astro/site.7fc1.css
Refresh on publication
/guides/index.html

Publish prerendered HTML and hashed assets

Use the Astro build as a Cloud CDN origin. Cache HTML and assets globally, transform images at the edge, and keep server islands dynamic when they cannot be shared.

Static HTML worldwide

The edge can reuse fresh prerendered HTML for subsequent requests.

Content images on demand

Resize and convert Astro content images without rebuilding every breakpoint.

Server islands stay optional

Cache static routes. Bypass server islands that are user-specific.

Configuration

Cloud CDN overview
  1. Publish the Astro build to an origin

    Use a files host, a VM or a static host that Cloud CDN can pull.

  2. Cache pages and hashed assets

    Long TTL for fingerprinted files. Purge HTML on each build.

  3. Add image transformation

    Convert hero and content images to WebP or AVIF at delivery time.

  4. Map the site domain

    Attach a managed or custom certificate and cut over DNS.

Operational outcomes

  • Prerendered Astro routes can share cached HTML
  • Builds purge HTML immediately
  • Images can be adapted without extra build steps
  • Hybrid server routes can stay dynamic

Frequently asked questions

Can I use this with Astro SSR?

Yes. Cache static and shareable SSR output. Bypass personalised server routes.

Does this replace astro:assets?

You can still use Astro assets as origin files. Cloud CDN caches and can further transform them.

How do I invalidate after a build?

Purge HTML and any unhashed paths as part of the deploy pipeline.

Is HTTP/3 available?

Yes. Cloud CDN supports HTTP/3, HTTP/2 and Brotli or Gzip compression.