Getting “page over page” problem in laravel 11+ using inertia react for frontend

I have been struggling with this error for 2 weeks. Project setup is basically simple:

  • docker-compose for building app, redis and mariadb containers
  • nginx on production server for serving app and build assets from react

After a while, especially while submitting login or any POST request handling from react jsx template (using inertia router.post method), it opens up a new window inside current one with redirect.

Here is my login controller method

public function login(Request $request)
{
    $credentials = $request->validate([
        'email' => 'required|email',
        'password' => 'required',
    ]);

    if (Auth::guard('client')->attempt($credentials, $request->boolean('remember'))) {
        $client = Auth::guard('client')->user();

        if ($client->status) {
            $request->session()->regenerate();

            return Inertia::location(route('client.admin'));
        }

        Auth::guard('client')->logout();

        throw ValidationException::withMessages([
            'email' => 'Your account is inactive.',
        ]);
    }

    throw ValidationException::withMessages([
        'email' => 'The provided credentials do not match our records.',
    ]);
}

Attaching screenshots:

plaintext JSON output of login form followed by "Redirecting to" login form with "Email" and "Password" fields, "Remember me" checkbox, and "LOG IN" button

I would appreciate any help in resolving this. Thanks.