Laravel Breeze logout redirect on 127.0.0.1 on shared host

Viewed 23

I have domain for example aaa.com. And I deploy Laravel on my webhost succesfully. Login, pages, all things etc. works fine. but whenever I logout it redirects me to 127.0.0.1 not aaa.com. Of course, I have to point out that I am using Laravel Breeze and here is what I wrote:

my logout form inside any page.

<form method="POST" action="{{ route('logout') }}">
     @csrf

    <button type="submit" class="underline text-sm text-gray-600 hover:text-gray-900">
        {{ __('Log Out') }}
    </button>
</form>

My web.php include require __DIR__.'/auth.php'; . Does not contain any logout redirects.

and inside auth.php

    Route::post('logout', [AuthenticatedSessionController::class, 'destroy'])
->name('logout');

and finally AuthenticatedSessionController.php

public function destroy(Request $request)
{
    Auth::guard('web')->logout();

    $request->session()->invalidate();

    $request->session()->regenerateToken();

    return redirect('/');
}

I don't understand why I am being redirected to 127.0.0.1 instead of aaa.com?

Edit: and forgot to mention my .env file include

APP_URL=https://aaa.com
2 Answers

In .env file, Change APP_URL

APP_URL=http://aaa.com

Thank you to everyone who replied. It fixed itself the next day. It must be something left in the web host's cache, or your browser's. It's not a Laravel thing.

Related