Sign out 405 in Production
Hi all, I have a problem with logging out in production. I don't know what's wrong with my code because it works perfectly locally (using Sail). In production, when I click the 'Sign Out' menu, I get a 405 error. It seems that the link is using the GET method.
this is my config auth.php
<?php
return [
'defaults' => [
'guard' => 'agent',
'passwords' => 'agents',
],
'guards' => [
'agent' => [
'driver' => 'session',
'provider' => 'agents',
],
],
'providers' => [
'agents' => [
'driver' => 'eloquent',
'model' => App\Models\Agent::class,
],
// 'users' => [
// 'driver' => 'database',
// 'table' => 'users',
// ],
],
'passwords' => [
'users' => [
'provider' => 'users',
'table' => 'password_reset_tokens',
'expire' => 60,
'throttle' => 60,
],
],
'password_timeout' => 10800,
];
Solution:Jump to solution
I think the problem is because of HTTPS, so I changed my
AppServiceProvider
and in register()
set this code to override to HTTPS
`
public function register(): void
{
if (App::environment('production')) {...1 Reply
Solution
I think the problem is because of HTTPS, so I changed my
AppServiceProvider
and in register()
set this code to override to HTTPS
public function register(): void
{
if (App::environment('production')) {
URL::forceScheme('https');
}
}