Improved http vs https detection
To fix issues with cloudflare dns routing.
This commit is contained in:
@ -43,10 +43,16 @@ class Route {
|
|||||||
* @return string - The string representation of the server's transfer protocol
|
* @return string - The string representation of the server's transfer protocol
|
||||||
*/
|
*/
|
||||||
public static function getProtocol() {
|
public static function getProtocol() {
|
||||||
if ( !empty( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] !== 'off' ) {
|
if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') {
|
||||||
return 'https';
|
return 'https';
|
||||||
}
|
}
|
||||||
if ( $_SERVER['SERVER_PORT'] == 443 ) {
|
if (!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') {
|
||||||
|
return 'https';
|
||||||
|
}
|
||||||
|
if (!empty($_SERVER['HTTP_X_FORWARDED_PORT']) && $_SERVER['HTTP_X_FORWARDED_PORT'] == 443) {
|
||||||
|
return 'https';
|
||||||
|
}
|
||||||
|
if (!empty($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == 443) {
|
||||||
return 'https';
|
return 'https';
|
||||||
}
|
}
|
||||||
return 'http';
|
return 'http';
|
||||||
|
Reference in New Issue
Block a user