From 6b3ed280f2cfe961477a9515c6d49a295cdadf5e Mon Sep 17 00:00:00 2001 From: kenjis Date: Sat, 11 Nov 2023 21:38:43 +0900 Subject: [PATCH] fix: force_https() redirects to wrong URL --- system/Common.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/system/Common.php b/system/Common.php index 2d876564846e..d3c5884d7c4a 100644 --- a/system/Common.php +++ b/system/Common.php @@ -502,7 +502,8 @@ function force_https( Services::session()->regenerate(); // @codeCoverageIgnore } - $baseURL = config(App::class)->baseURL; + $config = config(App::class); + $baseURL = $config->baseURL; if (strpos($baseURL, 'https://') === 0) { $authority = substr($baseURL, strlen('https://')); @@ -512,10 +513,12 @@ function force_https( $authority = $baseURL; } + $indexPage = ($config->indexPage === '') ? '' : $config->indexPage . '/'; + $uri = URI::createURIString( 'https', $authority, - $request->getUri()->getPath(), // Absolute URIs should use a "/" for an empty path + $indexPage . $request->getUri()->getRoutePath(), $request->getUri()->getQuery(), $request->getUri()->getFragment() );