[PATCH] SSL detection fails when behind a load balancer
-
Hello,
Under 1.5 of this plugin, SSL is not detected as active when using a load balancer.
To correct this the plugin needs to check for the X-FORWARDED-PROTO header:
$is_ssl = false; if ( isset( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) ) { // Something is sat in front of us, assume it knows best $is_ssl = strtolower( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) === 'https' ? true : false; } else { if ( ( function_exists( 'getenv' ) and ( ( getenv( 'HTTPS' ) != '' and getenv( 'HTTPS' ) != 'off' ) or ( getenv( 'SERVER_PORT' ) == '433' ) ) ) or ( isset( $_SERVER ) and ( ( isset( $_SERVER['HTTPS'] ) and $_SERVER['HTTPS'] !='' and $_SERVER['HTTPS'] != 'off' ) or ( isset( $_SERVER['SERVER_PORT'] ) and $_SERVER['SERVER_PORT'] == '443' ) ) ) ) { $is_ssl = true; } } $this->is_ssl = $is_ssl;
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘[PATCH] SSL detection fails when behind a load balancer’ is closed to new replies.