Created
September 2, 2016 18:17
-
-
Save neo22s/27e83161d928e9252c2496c7748adb79 to your computer and use it in GitHub Desktop.
is_HTTPS_protocol working until today.
This file contains 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 | |
/** | |
* checks if is https by protocol used in nginx | |
* @return boolean | |
*/ | |
public static function is_HTTPS_protocol() | |
{ | |
//we are sure is a https request , we use first the Nginx forwarded PROTO OR apache | |
if( (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) AND $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') | |
OR (isset($_SERVER['REQUEST_SCHEME']) AND $_SERVER['REQUEST_SCHEME'] == 'https') | |
) | |
{ | |
//so we can use it later | |
$_SERVER['HTTPS']='on'; | |
return TRUE; | |
} | |
return FALSE; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment