Request: modify is_ssl() function to check for HTTP_X_FORWARDED_PROTO
-
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.
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Request: modify is_ssl() function to check for HTTP_X_FORWARDED_PROTO’ is closed to new replies.