CDN for Nuxt

Serve versioned Nuxt assets through Cloud CDN. Choose separate cache lifetimes for prerendered pages and Nitro routes that return shared content.

Example cache policy
Public, cacheable resource
/_nuxt/entry.d520.js
Bypass shared cache
/api/session

Deploy Nuxt bundles and prerendered routes

Cache _nuxt assets with long TTLs. Cache anonymous pages and payloads at Cloud CDN. Bypass preview and authenticated routes. Purge on deploy.

Client bundles at the edge

A hashed file under /_nuxt/ can stay cached when a new build publishes a different filename.

SSG and SSR HTML you can cache

Anonymous routes can be stored at Cloud CDN so Node is not on every page view.

One hostname for the app

Assets, pages and APIs you expose can share the same distribution and certificate.

Configuration

Cloud CDN overview
  1. Connect the Nuxt origin

    Pull the Nitro or static-host origin over HTTPS.

  2. Split cache policy by path

    Immutable cache for _nuxt. Purgeable cache for HTML and payload files.

  3. Bypass preview

    Nuxt preview and user-specific routes must reach the origin.

  4. Purge on release

    Invalidate HTML after each production deploy.

Operational outcomes

  • Nuxt client assets are cached globally
  • Shareable pages live at the edge
  • Preview remains dynamic
  • Releases purge HTML immediately

Frequently asked questions

Does this work with Nuxt SSG?

Yes. Static output is an ideal CDN origin. Cloud CDN adds global cache, TLS and purge.

What about ISR-style routes?

Cache the generated HTML and purge or use a TTL that matches how fresh the page must be.

Can I cache server API routes?

Only public GET responses. Authenticated or mutation APIs must bypass cache.

How do I handle hybrid rendering?

Give each route a cache policy that matches whether the HTML is shareable.