How to identify if a request uses HTTPS?

Asked

Viewed 356 times

2

I have to identify if the system sending us a request is HTTPS.

if ($isHTTPS){
  #faça alguma coisa
}
else{
 #faça outracoisa
}

1 answer

2

As follows:

if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') { //HTTPS } 
  • 3

    It works, but it has some caveats. A discussion about it can be found in the OS: http://stackoverflow.com/questions/1175096/

Browser other questions tagged

You are not signed in. Login or sign up in order to post.