From ddf2caaccc81e050b2cdd6c227986ab89f3ec937 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Mon, 30 Aug 2021 15:01:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- http-server/Message/Uri.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/http-server/Message/Uri.php b/http-server/Message/Uri.php index 74bfe499..760cd24d 100644 --- a/http-server/Message/Uri.php +++ b/http-server/Message/Uri.php @@ -152,7 +152,7 @@ class Uri implements UriInterface */ public function getDefaultPort(): int { - return 80; + return $this->scheme == 'https' ? 443 : 80; } @@ -224,7 +224,7 @@ class Uri implements UriInterface $uri = new Uri(); $uri = $uri->withScheme(!empty($server['https']) && $server['https'] !== 'off' ? 'https' : 'http'); if (isset($request->header['x-forwarded-proto'])) { - $uri->withScheme($request->header['x-forwarded-proto']); + $uri->withScheme($request->header['x-forwarded-proto'])->withPort(443); } $hasPort = false;