WordPress.org

Ready to get started?Download WordPress

Forums

Use Google Libraries
[resolved] [PATCH] SSL detection fails when behind a load balancer (2 posts)

  1. The Mysterious X
    Member
    Posted 1 year ago #

    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/

  2. Jason Penney
    Member
    Plugin Author

    Posted 1 year ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.