[Plugin: WordPress HTTPS (SSL)] Modified for CloudFlare
-
Hi, I modded a function in your plugin to work with CloudFlares SSL, so you might consider including this functionality in future releases.. (Credit goes to Gravity Forms for a snippet of code here)
Here you go:
public function is_ssl() {
$https_url = parse_url($this->https_url);
// Some extra checks for proxies and Shared SSL
if ( is_ssl() && strpos($_SERVER[‘HTTP_HOST’], $https_url[‘host’]) === false && $_SERVER[‘SERVER_ADDR’] != $_SERVER[‘HTTP_HOST’] ) {
return false;
} else if ( isset($_SERVER[‘HTTP_X_FORWARDED_PROTO’]) && strtolower($_SERVER[‘HTTP_X_FORWARDED_PROTO’]) == ‘https’ ) {
return true;
} else if ( $this->diff_host && !is_ssl() && isset($_SERVER[‘HTTP_X_FORWARDED_SERVER’]) && strpos($this->https_url, ‘https://’ . $_SERVER[‘HTTP_X_FORWARDED_SERVER’]) !== false ) {
return true;
}
elseif ( isset($_SERVER[“HTTP_CF_VISITOR”]) && strpos($_SERVER[“HTTP_CF_VISITOR”], “https”)){
return true;
} else if ( $this->diff_host && !is_ssl() && strpos($_SERVER[‘HTTP_HOST’], $https_url[‘host’]) !== false && (!$this->ssl_port || $_SERVER[‘SERVER_PORT’] == $this->ssl_port) && (isset($https_url[‘path’]) && !$https_url[‘path’] || strpos($_SERVER[‘REQUEST_URI’], $https_url[‘path’]) !== false) ) {
return true;
}
return is_ssl();
}
- The topic ‘[Plugin: WordPress HTTPS (SSL)] Modified for CloudFlare’ is closed to new replies.