diff --git a/src/Proxy.php b/src/Proxy.php index 2e388a8..28ee3df 100644 --- a/src/Proxy.php +++ b/src/Proxy.php @@ -63,15 +63,11 @@ public function to($target) $target = new Uri($target); - // Overwrite target scheme and host. + // Overwrite target scheme, host and port. $uri = $this->request->getUri() ->withScheme($target->getScheme()) - ->withHost($target->getHost()); - - // Check for custom port. - if ($port = $target->getPort()) { - $uri = $uri->withPort($port); - } + ->withHost($target->getHost()) + ->withPort($target->getPort()); // Check for subdirectory. if ($path = $target->getPath()) {