add fallback to system-hostname for faulty http-clients not setting 'Host' in the request
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
@@ -92,6 +92,17 @@ class UI
|
|||||||
*/
|
*/
|
||||||
public static function sendHeaders()
|
public static function sendHeaders()
|
||||||
{
|
{
|
||||||
|
if (empty($_SERVER['HTTP_HOST'])) {
|
||||||
|
if (!self::$install_mode) {
|
||||||
|
// fallback to set hostname in settings
|
||||||
|
$_SERVER['HTTP_HOST'] = Settings::Get('system.hostname');
|
||||||
|
} else {
|
||||||
|
// bad request
|
||||||
|
http_response_code(400);
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
session_set_cookie_params([
|
session_set_cookie_params([
|
||||||
'lifetime' => self::$install_mode ? 7200 : 600, // will be renewed based on settings in lib/init.php
|
'lifetime' => self::$install_mode ? 7200 : 600, // will be renewed based on settings in lib/init.php
|
||||||
'path' => '/',
|
'path' => '/',
|
||||||
|
|||||||
Reference in New Issue
Block a user