Skip to content

Commit

Permalink
fix: force_https() redirects to wrong URL
Browse files Browse the repository at this point in the history
  • Loading branch information
kenjis committed Nov 12, 2023
1 parent d5a6b17 commit 6b3ed28
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions system/Common.php
Original file line number Diff line number Diff line change
Expand Up @@ -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://'));
Expand All @@ -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()
);
Expand Down

0 comments on commit 6b3ed28

Please sign in to comment.