title: Detecting HTTPS requests in PHP
body: <p>The problem that I am having has to do with the need to keep some urls of a website protected by HTTPS and the rest kicked to HTTP.</p>
  
  <p>Normally, you have <code>$_SERVER['HTTP_HTTPS']</code> or <code>$_SERVER['HTTPS']</code> (depending on your flavor of Apache). You also can check the port - it's 80 for normal traffic and 443 for HTTPS. </p>
  
  <p>My problem is that the <strong>certificate sits on the loadbalancer</strong>, and all these variables are unavailable, and the webserver sees <a href="http://www.foo.com" rel="noreferrer">http://www.foo.com</a> on port 80. One way to fix this is to tell the loadbalancer to send the traffic on a different port, but I wonder if there are other ways to detect HTTPS coming from the load balancer?</p>