Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

635
Vistas
Laravel login error 'Header may not contain more than a single header, new line detected laravel login'

I am making a multi-auth custom login for clients. The login/logout works fine the first time I login, but shows this error in the second attempt

ErrorException in Response.php line 339: Header may not contain more than a single header, new line detected'

what may be the cause for this?

about 4 years ago · Santiago Trujillo
3 Respuestas
Responde la pregunta

0

I'm facing same issue. Watching closely, I noticed that the header that is being passed contains not just a newline char, but also html code. A code for a page just annoucing the redirection to the route I wanted it to redirect.

My login is redirectTo is

/**
 * Where to redirect users after login.
 *
 * @return string
 */
protected function redirectTo()
{
    return redirect()->route((string)\Auth::user()->group->type);
}

Where already exists a named route for each group->type possible.

I've already tried just a return to the route path with no success or any different error message.

[UPDATE] I found a fix here, changed my code to this and it worked:

protected function redirectTo()
{
    // return redirect()->route((string)\Auth::user()->group->type);
    return route(\Auth::user()->group->type);
}
about 4 years ago · Santiago Trujillo Denunciar

0

you should use

return route('admin.dashboard');

instead of

 return redirect('admin/dashboard');
about 4 years ago · Santiago Trujillo Denunciar

0

Try it in LoginController.

public function redirectTo(){

   $user_id = Auth::user()->id;

   $role_manager = User::where('id', $user_id)->value('role');

   if($role_manager == 'manager'){

       return $this->redirectTo = 'dashboard';

   }
}
about 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda