Laravel ASSET_URL and Mix/Vite on a CDN

Point Laravel Vite and Mix builds at Cloud CDN with ASSET_URL, cache public storage, and keep session Blade on origin.

Laravel workers should run application code. They should not stream hashed Vite files and public disk images to every region. ASSET_URL and a media hostname exist so Cloud CDN can take that work.

Hashed builds first

Set ASSET_URL to the Cloud CDN hostname after origin pull works for public/build. Fingerprinted Vite or Mix files get a long TTL. mix-manifest and unhashed HTML still purge on deploy if you cache them.

Session Blade, CSRF forms and dashboards stay on Laravel.

public/storage

Map the public disk to Cloud CDN. Transform images at the edge when listings need extra sizes. Keep signed private files on origin URLs.

Marketing pages versus the app

Anonymous landing pages can be cached as HTML. The authenticated application should not. Split by path instead of hoping a single policy fits both.

Forge, Vapor and containers

Cloud CDN sits in front of whichever origin those platforms expose. The distribution does not care whether PHP runs in a container or on a VM.

Frequently Asked Questions

Only anonymous pages without per-session CSRF HTML. Most app pages should bypass cache.

Hashed files do not need purge. Purge HTML or unhashed manifests if you cache them.

You can still put Cloud CDN in front of the public hostname those assets are served from.

Put this on Cloud CDN.

Get started with our Management Console in less than 2 minutes, or connect with an expert to supercharge your business today.