Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

laravel Redirect::to() loses the port

I'm running my development environment through vagrant (Ubuntu, nginx, php-fpm) and accessing the server on localhost:8080. I'm using Laravel 4 and trying to set up my authentication system. It seems that Laravel just ignores the port you are using if you are using an alternative port. Is this true? For example, when I run a redirect from http://localhost:8080/login to /profile I end up on http://localhost/profile. Does anyone have any suggestions on how I can fix/patch this?

like image 347
Ben Kulbertis Avatar asked May 08 '13 23:05

Ben Kulbertis


1 Answers

This smells like a bug. I get stuck digging in the UrlGenerator when it looks for the request->root(). From what I can see there is no root() function on the Symfony\Component\HttpFoundation\Request. You could try replacing ->root() with ->getBaseUrl() instead.

Regardless of the outcome, you should prepare a small test case (with as little excess code as possible) and report the issue on GitHub to be fixed. If you can find a solution while you're at it then a pull request can be made to fix the issue.

like image 194
Phill Sparks Avatar answered Sep 20 '22 12:09

Phill Sparks