Created
February 29, 2012 14:12
-
-
Save thom4parisot/1941132 to your computer and use it in GitHub Desktop.
WordPress + AlwaysData + HTTPS = #win
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action('init', 'alwaysdata_ssl'); | |
/** | |
* Enables proper HTTPS detection with WordPress and Alwaysdata | |
*/ | |
function alwaysdata_ssl() | |
{ | |
if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') | |
{ | |
$_SERVER['HTTPS'] = 'on'; | |
$_SERVER['SERVER_PORT'] = 443; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment