Skip to content

Commit 809afca

Browse files
benjaminkottandi34
authored andcommitted
bugfix: use HTTP_HOST instead of SERVER_NAME
1 parent 44f6c8a commit 809afca

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/Utility/PathUtility.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public static function getPublicPath(string $path = '', bool $absolute = false):
6565

6666
$path = self::fixFilePath(self::getBaseUrl() . $path);
6767
if ($absolute) {
68-
$path = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? 'https' : 'http') . '://' . $_SERVER['SERVER_NAME'] . $path;
68+
$path = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . $path;
6969
}
7070

7171
return $path;

tests/Unit/Utility/PathUtilityTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public static function providerGetPublicPath(): array
7272
public function testGetPublicPathAbsolute(string $path, string $expected): void
7373
{
7474
$_SERVER['HTTPS'] = 'on';
75-
$_SERVER['SERVER_NAME'] = 'photoboothproject.github.io';
75+
$_SERVER['HTTP_HOST'] = 'photoboothproject.github.io';
7676
$this->assertSame($expected, PathUtility::getPublicPath($path, true));
7777
}
7878

0 commit comments

Comments
 (0)