Question
Laravel ↔ Vue/React: Inertia.js Redirect and Status‑Code Interoperability
Lax Indigo
0 reputation · 11 Jan 2020, 18:51 UTC
33.1K views0
Goal
Determine how Inertia.js should behave when a server framework (e.g., Laravel) returns a 302 status code together with a valid Inertia JSON payload that includes a redirect key, and how the various client adapters (Vue, React, Svelte) interpret that response.
Constraints & Uncertainty
- The official documentation states a 200 status is required for a valid Inertia response, yet does not forbid 3xx responses with an Inertia body.
- The
redirectkey is not formally part of the public contract, and the defaultshouldRedirectcallback implementation is undocumented. - Adapter implementations differ: some automatically follow the redirect, others render the component and ignore the navigation instruction.
Specific questions:
- Should a 302 response with an Inertia payload be treated as a client‑side redirect by default, or must the client explicitly handle the
redirectkey? - Is the presence of the
redirectkey guaranteed to remain stable across future Inertia releases? - What is the recommended pattern for handling 4xx/5xx responses that still contain a valid Inertia payload?