When FORCE HTTPS ON is selected in the CMS, on every request we have the PHP code check that the HTTP_SCHEME is in HTTP_X_FORWARDED_PROTO is https and if it is not, we issue a redirect to https.
What is happening for you @aponkye is that your https:// URL does not contain https because the proxy is not setting that correctly.
You could put a really simple test file in /custom/userscripts called test.php containing:
<?php
echo 'Testing HTTPS' . PHP_EOL;
echo 'REMOTE_ADDR: ' . $_SERVER['REMOTE_ADDR'] . PHP_EOL;
echo 'HTTP_X_FORWARDED_PROTO: ' . $_SERVER['HTTP_X_FORWARDED_PROTO'] . PHP_EOL;
You are missing:
proxy_set_header X-Forwarded-Proto $scheme;
Sorry for the delay, if you have moved on then at least this might assist someone else!