//SSL
if (
    isset($_SERVER['HTTPS']         )                                                                                   ||
    isset($_SERVER['REDIRECT_HTTPS'])                                                                                   ||
    ( isset($_SERVER['HTTP_X_FORWARDED_PROTO']          ) && 'https' === $_SERVER['HTTP_X_FORWARDED_PROTO']         )   ||  //AWS
    ( isset($_SERVER['HTTP_CLOUDFRONT_FORWARDED_PROTO'] ) && 'https' === $_SERVER['HTTP_CLOUDFRONT_FORWARDED_PROTO'])       //AWS(CloudFront)
) {
    return true;
//非SSL
} else {
    return false;
}
Sign up for free and join this conversation.
Sign Up
If you already have a Qiita account log in.