CDN for Angular

Cache hashed JavaScript and CSS bundles. Refresh the application shell on deployment and ensure deep links for client-side routes still return the correct document.

Example release policy
Versioned resource
/main-75KEF3TL.js
Refresh on publication
/index.html

Deliver Angular bundles across releases

Cache / and hashed bundles at Cloud CDN. Serve index.html with a purgeable TTL. Keep API and authenticated XHR on the application origin.

Hashed bundles worldwide

Content-hashed main, polyfill and lazy-loaded chunks can retain long cache lifetimes.

Prerendered routes at the edge

SSG or prerender HTML can be cached and purged on release.

Same edge as Cloud DNS

Use Cloud DNS to resolve the application hostname and Cloud CDN to deliver its assets.

Configuration

Cloud CDN overview
  1. Host the Angular build

    Serve the dist output from any HTTPS origin.

  2. Cache hashed files for a long time

    Fingerprinted JS, CSS and assets get long TTLs. index.html is purged on deploy.

  3. Configure SPA fallback if needed

    Unknown paths can fall back to index.html at the origin or via hosting rules.

  4. Map the app domain

    Attach TLS and cut over DNS after verifying the test hostname.

Operational outcomes

  • Angular bundles are cached globally
  • index.html can be purged on each release
  • API calls remain dynamic
  • Prerendered routes can be edge-cached

Frequently asked questions

Does this work with Angular SSR?

Yes. Cache shareable SSR HTML. Bypass responses that vary on cookies or session.

How should cache busting work?

Keep Angular output hashing. Long-cache the hashed files and purge index.html on deploy.

Can I accelerate Angular Universal?

Treat Universal as an origin. Cache anonymous rendered routes and keep user-specific routes dynamic.

What about i18n builds?

Cache each locale path or hostname separately so locale bundles are not mixed.