People searching “Inertia redirect back” return back() from a create form and land on the create form again. That is what back() means. The CRUD guide uses to_route('posts.index') after a save so the next page is the list.
TL;DR
- back() returns to the page that posted.
- to_route() is the right call when the next page is a specific list.
- Do not
return response()->json(['ok' => true])from an Inertia action and then navigate inonSuccess. - Do not
return back()from a test and assert a JSON body.
The fix#
Use back() when the user should stay where they were. A row button on the list is the usual case:
public function publish(Request $request, Post $post): RedirectResponse
{
$this->authorize('update', $post);
$post->update(['published_at' => now()]);
return back();
}Inertia follows the redirect. The Vue page does not call router.visit after form.post unless you are doing something the redirect cannot express.
Use to_route() when the destination is fixed. Use redirect()->route('posts.edit', $post) after create when the next step is the editor.
What to avoid#
Gotcha
Do not return response()->json(['ok' => true]) from an Inertia action and then navigate in onSuccess. You dropped the redirect Inertia is built around. Do not return back() from a test and assert a JSON body.
FAQ#
How do I redirect back after an Inertia form?
back() returns to the page that posted. to_route() is the right call when the next page is a specific list.
What goes wrong with Inertia redirect back?
Many developers return back() from a create form and land on the create form again. Do not return response()->json(['ok' => true]) from an Inertia action and then navigate in onSuccess.



