Search code examples
phpapachewebserver

Why isn't _SERVER["HTTPS"] set to 1?


My site has an SSL cert and I'm hitting https://mysite.com/info.php, but under the PHP Variables section _SERVER["HTTPS"] is not being reported. I believe this is causing a problem with a Drupal site where some URLs are being written to the page as https://... where others are being written as http://...

What determines if _SERVER["HTTPS"] is set?


EDIT: This may be the answer to my problem Detecting HTTPS vs HTTP on server sending back nothing useful. Could be a load balancer issue


Solution

  • It turns out that because of the Load Balancer, which handles the SSL encryption/decryption the Web Server doesn't get $_SERVER["HTTPS"], but $_SERVER["HTTP_USESSL"] is set and can be used as a flash for SSL traffic.