This is not an ideal solution, but I had problems with Magento 1.9.x.
The setting was: Nginx Proxy & SSL Terminator => Apache Webserver
No matter what I did, enabling SSL triggered a redirect cycle. I narrowed down the issue to Magento, not with Nginx configurations.
Magento did not seem to know that he received a secure connection from Nginx, even if the correct headers were set.
The dirty solution was to add the code to the lowest index.php in the magento root directory (i.e. /var/www/magento ) just before the line Mage::run... , for example:
if( isset($_SERVER['HTTP_X_FORWARDED_PROTO']) ) { $_SERVER['HTTPS'] = 'on'; $_SERVER['SERVER_PORT'] = 443; } Mage::run($mageRunCode, $mageRunType);
source share