WebStack-Laravel icon indicating copy to clipboard operation
WebStack-Laravel copied to clipboard

管理后台登录时,ERR_TOO_MANY_REDIRECTS

Open totemtec opened this issue 4 years ago • 4 comments

一直不停的redirect

wget http://127.0.0.1:8000/admin

--2021-03-12 12:13:46-- http://127.0.0.1:8000/admin Connecting to 127.0.0.1:8000... connected. HTTP request sent, awaiting response... 302 Found Location: http://127.0.0.1:8000/admin/auth/login [following] --2021-03-12 12:13:46-- http://127.0.0.1:8000/admin/auth/login Connecting to 127.0.0.1:8000... connected. HTTP request sent, awaiting response... 302 Found Location: http://127.0.0.1:8000/admin/auth/login [following] --2021-03-12 12:13:46-- http://127.0.0.1:8000/admin/auth/login Connecting to 127.0.0.1:8000... connected. HTTP request sent, awaiting response... 302 Found Location: http://127.0.0.1:8000/admin/auth/login [following] --2021-03-12 12:13:46-- http://127.0.0.1:8000/admin/auth/login Connecting to 127.0.0.1:8000... connected. HTTP request sent, awaiting response... 302 Found Location: http://127.0.0.1:8000/admin/auth/login [following] --2021-03-12 12:13:46-- http://127.0.0.1:8000/admin/auth/login

totemtec avatar Mar 12 '21 17:03 totemtec

PHP7.4 日志没有报错 Nginx日志也没错误

totemtec avatar Mar 12 '21 17:03 totemtec

+1,我的也是管理界面一直302进不去,提示重定向次数过多,首页可以正常访问。

eessn avatar Mar 26 '21 08:03 eessn

看到有大佬解决了:https://www.daniao.org/13006.html

tmmtoo avatar Mar 28 '21 03:03 tmmtoo

修复后台登录页面无限重定向,在根目录找到文件:config/admin.php

添加如下代码:

'auth'=>[ ...

'excepts'=>[ 'auth/login', ] ],

一下是编辑后大概的样子如下:

'auth' => [

    'controller' => App\Admin\Controllers\AuthController::class,

    'guards' => [
        'admin' => [
            'driver'   => 'session',
            'provider' => 'admin',
        ],
    ],
    
   'excepts'=>[
   'auth/login',
    ],

    'providers' => [
        'admin' => [
            'driver' => 'eloquent',
            'model'  => Encore\Admin\Auth\Database\Administrator::class,
        ],
    ],
],

/*

felixyin avatar Jun 10 '21 16:06 felixyin