I'm using Sentinel - https://github.com/rydurham/Sentinel - to handle user auth for my app, and have the entire 'admin' subdomain in routes.php wrapped up like so:
Route::group([ "domain" => 'app.domain.dev', 'before' => 'Sentinel\auth' ], function()
{
Route::group(array('prefix' => 'one'), function()
{
...
});
Route::group(array('prefix' => 'two'), function()
{
...
});
Route::get('/', array('as' => 'home', 'uses' => 'DashboardController@index'));
});
On a local machine, everything works fine - app.domain.dev displays the admin dashboard if logged in, and the login page if not, while logging out returns the user to the login page.
Once deployed via Forge, however, app.domain.dev causes an infinite loop error if not logged in. Yet /login is still accessible and working - once logged in, the dashboard loads fine. If the user logs out, they hit the infinite loop error again.
I'm not sure why this works locally and not deployed, but I'm guessing it's something do to with the 'home' route sitting inside the 'Sentinel\auth' filtered group?
Sentinel's auth filter:
Route::filter('Sentinel\auth', function()
{
if (!Sentry::check()) return Redirect::guest(Config::get('Sentinel::config.routes.login'));
});
...and config.routes.login is set to 'login'.
I understand the similarities of this question - Redirect loop in laravel - but it's the working locally / broken deployed that confuses me.
Kind of solved it. As the link suggested, the easiest (hackiest) way is to remove the root, erm, route from the auth group:
I'm sure there are more elegant solutions, but I leave this here in case it's of any use.