Skip to content

Instantly share code, notes, and snippets.

@vaxxis
Created October 9, 2015 16:04
Show Gist options
  • Save vaxxis/c5ed05f0f553d0a39e9c to your computer and use it in GitHub Desktop.
Save vaxxis/c5ed05f0f553d0a39e9c to your computer and use it in GitHub Desktop.
<?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;
}
if ( isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']) == 'https' ) {
return true;
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment