Skip to content

Commit e120448

Browse files
committed
Support of error pages behind a load balancer that serves HTTPS but accesses the webserver on HTTP. Without this css is loaded on HTTP from a document loaded over HTTPS
1 parent 8460e4e commit e120448

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

pub/errors/processor.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,8 @@ public function getHostUrl()
265265
$host = 'localhost';
266266
}
267267

268-
$isSecure = (!empty($_SERVER['HTTPS'])) && ($_SERVER['HTTPS'] != 'off');
268+
// HTTP_X_FORWARDED_PROTO to check whether a webserver using HTTP is behind a load balancer serving HTTPS
269+
$isSecure = (!empty($_SERVER['HTTPS'])) && ($_SERVER['HTTPS'] != 'off') || $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https';
269270
$url = ($isSecure ? 'https://' : 'http://') . $host;
270271

271272
if (!empty($_SERVER['SERVER_PORT']) && !in_array($_SERVER['SERVER_PORT'], [80, 443])

0 commit comments

Comments
 (0)