diff --git a/src/UrlGenerator.php b/src/UrlGenerator.php index 92880de1..f3d8e39e 100644 --- a/src/UrlGenerator.php +++ b/src/UrlGenerator.php @@ -88,7 +88,9 @@ class UrlGenerator extends RoutingBase { } $path = implode('/', $path_segments); - $scheme = (isset($_SERVER['HTTPS'])) ? 'https:' : 'http:'; + $isHttps = $_SERVER['SERVER_PORT'] === '443' || isset($_SERVER['HTTPS']); + + $scheme = ($isHttps) ? 'https:' : 'http:'; return "{$scheme}//{$this->host}/{$path}"; }