Support » Plugin: Use Google Libraries » [PATCH] SSL detection fails when behind a load balancer

  • Resolved The Mysterious X

    (@the-mysterious-x)


    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;

    http://wordpress.org/extend/plugins/use-google-libraries/

Viewing 1 replies (of 1 total)
  • Plugin Author Jason Penney

    (@jczorkmid)

    Thanks for the heads up.

    WP 3.5 adds Protocol Relative URL support, which should greatly simplify all this in the next UGL release, but I’ll add this for WP pre-3.5 as well.

Viewing 1 replies (of 1 total)
  • The topic ‘[PATCH] SSL detection fails when behind a load balancer’ is closed to new replies.