Cannot login to WordPress Admin with SSL terminated load balancer

I just figured out the issue.

You need to add the HTTPS/SSL settings before require_once(ABSPATH . 'wp-settings.php'); in your wp-config.php

So the relevant part of your wp-config.php should look like this.

define( 'FORCE_SSL_ADMIN', true );

// in some setups HTTP_X_FORWARDED_PROTO might contain
// a comma-separated list e.g. http,https
// so check for https existence
if( false !== strpos( $_SERVER['HTTP_X_FORWARDED_PROTO'], 'https' ) ) {
    $_SERVER['HTTPS'] = 'on';
}

/** Sets up WordPress vars and included files. */
require_once( ABSPATH . 'wp-settings.php' );

Leave a Comment