If you’re using a load balancer infront of your web servers and providing a Magento site, you might notice that you have issues if your SSL terminates on the load balancer.

You need to find a way to tell Magento that it’s receiving a secure connection, or else it will put you into a 302 redirect loop.

To do this, enabling HTTP_X_FORWARDED_PROTO is probably the best way forward. Your Load Balancer will add an additional header stating that the request was originally sent over HTTPS.

Open your index.php and locate the Mage::run($mageRunCode, $mageRunType); line.

Just above this, add the following code:

Image Credit: Marco Wessel