Created
July 19, 2015 12:32
-
-
Save fprochazka/648eb6b0fcca406a16cd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// hack for https proxies | |
if (isset($_SERVER['HTTP_X_FORWARDED_PROTO'])) { | |
if ($_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https' && isset($_SERVER['SERVER_PORT']) && in_array($_SERVER['SERVER_PORT'], [80, 82])) { // https over proxy | |
$_SERVER['HTTPS'] = 'On'; | |
$_SERVER['SERVER_PORT'] = 443; | |
} elseif ($_SERVER['HTTP_X_FORWARDED_PROTO'] === 'http' && isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == 80) { // http over proxy | |
$_SERVER['HTTPS'] = 'Off'; | |
$_SERVER['SERVER_PORT'] = 80; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment