Skip to content
Advertisement

Laravel 5.1 Response Routing Location new line detected

I try to redirect to an external app from laravel 5.1 using responses inside a controller:

$response = Response::make();
$value = trim("http://someapp.com/laraveltocake");
$response->header('Location:', $value);
return redirect($response);

I have no success as the error message was:

Header may not contain more than a single header, new line detected

Is there a better way to redirect from a Laravel route to an external app

In my case it is an legacy cakephp app module which still was not migrated to Laravel which is the goal of this project.

Advertisement

Answer

I think you’re overcomplicating this:

return redirect("http://someapp.com/laraveltocake");

should be enough.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement