Bombdogs
Member
Posted 1 year ago #
Hi,
the is_ssl() function in wp-includes/functions.php should be modified to include a check for HTTP_X_FORWARDED_PROTO. This is required if you are operating behind a load balancer that terminates the SSL connection and then forwards to the machines behind it on port 80 (common set-up on the Amazon cloud).
Suggest the following...
function is_ssl() {
if ( isset($_SERVER['HTTPS']) ) {
if ( 'on' == strtolower($_SERVER['HTTPS']) )
return true;
if ( '1' == $_SERVER['HTTPS'] )
return true;
} elseif ( isset($_SERVER['SERVER_PORT']) && ( '443' == $_SERVER['SERVER_PORT'] ) ) {
return true;
}
if ( isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']) == 'https' ) {
return true;
}
return false;
}
Currently I need to hand edit this function (and more importantly remember to!) every time we update WordPress.
Thanks.
Hi there,
It would be more useful to post this in Trac or under the Ideas section. I'll try to get a moderator's attention see what can be done.
Cheers!
The requests forum is a fine place for this.
josy1024@gmail.com
Member
Posted 1 year ago #
this worked for me in case of a varnish and https configuration:
if (req.http.X-Forwarded-Proto == "https" ) {
set req.http.X-Forwarded-Port = "443";
} else {
set req.http.X-Forwarded-Port = "80";
}
wp-includes/functions.php
function is_ssl() {
if ( isset($_SERVER['HTTPS']) ) {
if ( 'on' == strtolower($_SERVER['HTTPS']) )
return true;
if ( '1' == $_SERVER['HTTPS'] )
return true;
} elseif ( isset($_SERVER['SERVER_PORT']) && ( '443' == $_SERVER['SERVER_PORT'] ) ) {
return true;
} elseif ( isset($_SERVER['HTTP_X_FORWARDED_PORT']) && ( '443' == $_SERVER['HTTP_X_FORWARDED_PORT'] ) ) {
return true;
}
return false;
}
any word on this being absorbed by wp core?
I've been wanting to submit this for a while. We'll see what happens.
http://core.trac.wordpress.org/ticket/20567