src/Viserio/Component/Routing/Generator/UrlGenerator.php
protected function addPortAndSchemeToUri(UriInterface $uri, RouteContract $route): UriInterface
    {
        if ($route->isHttpOnly()) {
            $secure = 'http';
            $port   = 80;
        } elseif ($route->isHttpsOnly()) {
            $secure = 'https';
            $port   = 443;
        } else {
            $requestUri = $this->request->getUri();
            $secure     = $requestUri->getScheme();
            $port       = $requestUri->getPort();
        }

        $uri = $uri->withScheme($secure);

        return $uri->withPort($port);
    }
protected function addPortAndSchemeToUri(UriInterface $uri, RouteContract $route): UriInterface
    {
        if ($route->isHttpOnly()) {
            $secure = 'http';
            $port   = 80;
        } elseif ($route->isHttpsOnly()) {
            $secure = 'https';
            $port   = 443;
        } else {
            $requestUri = $this->request->getUri();
            $secure     = $requestUri->getScheme();
            $port       = $requestUri->getPort();
        }

        $uri = $uri->withScheme($secure);

        return $uri->withPort($port);
    }
Add the port and scheme to the uri if necessary.

@param \Psr\Http\Message\UriInterface            $uri
@param \Viserio\Component\Contract\Routing\Route $route

@return \Psr\Http\Message\UriInterface