Skip to content

Instantly share code, notes, and snippets.

@grola
Last active January 21, 2018 17:24
Show Gist options
  • Save grola/36138d483c12cc9d7c2c9442a740abf7 to your computer and use it in GitHub Desktop.
Save grola/36138d483c12cc9d7c2c9442a740abf7 to your computer and use it in GitHub Desktop.
Cloudflare Flexible SSL for Wordpress
$https_options = array( 'HTTP_CF_VISITOR', 'HTTP_X_FORWARDED_PROTO' );
foreach ( $https_options as $https_option ) {
if ( isset( $_SERVER[ $https_option ] )
&& ( strpos( $_SERVER[ $https_option ], 'https' ) !== false )
) {
$_SERVER[ 'HTTPS' ] = 'on';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment