Skip to content

Commit

Permalink
Add detection of HTTP_X_FORWARDED_* headers
Browse files Browse the repository at this point in the history
  • Loading branch information
ionphractal authored and julianxhokaxhiu committed Mar 29, 2020
1 parent c9325f2 commit 3dae36a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,16 @@
if ( array_key_exists('PROTO', $forwarded) && strtoupper($forwarded['PROTO']) === 'HTTPS') {
$_SERVER['HTTPS'] = 'on';
}
} else {
if ( isset($_SERVER['HTTP_X_FORWARDED_HOST']) ) {
$_SERVER['HTTP_HOST'] = $_SERVER['HTTP_X_FORWARDED_HOST'];
}
if ( isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && strtoupper($_SERVER['HTTP_X_FORWARDED_PROTO']) === 'HTTPS' ) {
$_SERVER['HTTPS'] = 'on';
}
}

if( isset($_SERVER['HTTPS'] ) )
if( isset($_SERVER['HTTPS']) )
$protocol = 'https://';
else
$protocol = 'http://';
Expand Down

0 comments on commit 3dae36a

Please sign in to comment.