If there is a load balancer or other server handling SSL in front of your webserver, you need a way to tell Magento that it’s receiving a secure connection, or else it will put you into a 302 redirect loop.
Put the following above the Mage::run… line at the bottom of your index.php to prevent this issue without overriding any Magento code:
This example is for Amazon EC2, but if your load balancer uses a different header, just change the `HTTP_X_FORWARDED_PROTO` portion.
* EC2′s load balancer sets these for us so we know we’re secure,
* preventing Magento from performing a redirect loop.