Laravel Auth with Subdominio

Asked

Viewed 195 times

5

Good morning, I’m trying to perform an auth with Ubdomain, but every time soon on the site returns the error of Too Many Redirects.

This is my .env:

SESSION_DOMAIN=.meudominio.com.br

And the first line of my route is this:

Route::domain('sis.meudominio.com.br')->middleware('admin')->group(function (){

I was having a problem where all the Routes that weren’t in that group worked, so I had to put this on the website part:

Route::domain('meudominio.com.br')->group(function(){ Auth::Routes();

The Auth::Routes() is there, because I wish only to log in the main path of the site.

  • The system is in the subdomain ??

1 answer

2


// Rotas que pertencem a um subdominio deverão ser registradas dentro do grupo
// Rotas para subdominio devem sempre ser declaradas antes das outras
Route::group(['domain' => '{account}.' . env('APP_DOMAIN')], function () {
    Route::get('/', 'Auth\LoginController@showLoginForm')->name('login');
});

// As demais rotas, registra-se normal
Route::get('/', function(){
    return view('welcome');
});

Browser other questions tagged

You are not signed in. Login or sign up in order to post.