Closed flip111 closed 5 years ago
+1 just hit the same bug
The problem is $target->getPort()
won't return ports 80/443 even if you specify it in the string, as it's supposed to:
It only returns non-standard ports. The problem is the new URI is made from $this->request->getUri()
, which includes the current (possibly non-standard) port, but then it only replaces it if $target->getPort()
is not null:
However withPort
does support null values and sets the port to the default 80/443!
So a much simpler solution is to remove the if
and always do $uri->withPort($target->getPort())
Applied @tostercx's suggestion on master 👌
This is needed for when you have a server not running on port 80 or 443 (such as the php built-in webserver
php -S localhost:8080
). And you want to forward the request to a server with port 80 or 443.