Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 364736f

Browse files
committed
FIX $_SERVER HTTP_X_FORWARDED_PREFIX key
1 parent 343367f commit 364736f

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

‎src/utils/UriHelper.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,9 +245,9 @@ public static function getSiteUrl(?string $path = null, array $sapiVars = [], bo
245245
$sapiVars['REQUEST_URI'] = $sapiVars['SCRIPT_NAME'] ?? '';
246246
$uri = static::getCurrentString($sapiVars, $cached);
247247
$uriParts = parse_url($uri);
248-
if (isset($sapiVars['X_FORWARDED_PREFIX'])) {
248+
if (isset($sapiVars['HTTP_X_FORWARDED_PREFIX'])) {
249249
$uriParts['path'] =
250-
'/' . ltrim($sapiVars['X_FORWARDED_PREFIX'], '/') .
250+
'/' . ltrim($sapiVars['HTTP_X_FORWARDED_PREFIX'], '/') .
251251
$uriParts['path'];
252252
}
253253
if (!empty($path)) {

‎test/UriHelperTest.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public function testGetSiteUrl()
118118
'SERVER_NAME' => 'localhost',
119119
'SERVER_PORT' => 3000,
120120
'SCRIPT_NAME' => 'index.php',
121-
'X_FORWARDED_PREFIX' => '/public'
121+
'HTTP_X_FORWARDED_PREFIX' => '/public'
122122
], false)
123123
);
124124
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /