I clicked the logo on one of my Laravel + Inertia sites and the homepage rendered inside Inertia's error modal — in production, on a 200 response. The cause: Inertia serves HTML and JSON under the same URL, my app had opted its pages into Cloudflare's edge cache with s-maxage, and Cloudflare ignores Vary: X-Inertia when deciding cache hits. The edge happily handed cached HTML to an XHR that expected a JSON page object.
The write-up walks through the live curl evidence (cf-cache-status: HIT for an X-Inertia: true request), why the no-store I already had on the JSON responses couldn't prevent it (store-time vs lookup-time defenses), the one-line fix, and the Cloudflare Cache Rule that lets you keep edge-cached HTML if you control your own zone. Plus a thirty-second curl test to check whether your own Inertia app is affected.
Originally published at andreasbergstrom.dev — read the full post there.
Top comments (0)