Redirect loop in laravel

半腔热情 提交于 2019-12-23 21:33:40

问题


How to use before filter in Laravel in a group?

Route::group(['before'=>'auth','domain' => 'm.domain.us'], function(){
    ...
    Route::get('/','PageController@index');
});

I tried in this way, if I use only domain in group it works but I want to use auth filter on all pages in this group because it is admin section and when I entered 'before' => 'admin' and it gets an error:

This webpage has a redirect loop.

Where is the problem here?


回答1:


Probably this occurs because your Login-Route is inside your ::group-filter.
This means: Program checks also on login page if user is logged in. Of course, the user is not -> Redirect::to('login') ... There you have your loop =)



来源:https://stackoverflow.com/questions/23147712/redirect-loop-in-laravel

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!