We ran into this issue for a client today, where we kept running into an infinite loop when the visitor went to a page that required SSL. After a lot of tracing, it turned out that the is_ssl() function in wp-includes was passing a false, even though the site was using SSL. Turned out we ran into a perfect storm of mis/non-standard configuration. The internally bound port for the site was not 443, but something else, after a few hours of inappropriately cursing the function, I decided to take a break and tackle the problem again. Discussed the issue on the #wordpress channel on irc, and fortunately Sivel was there, who pointed out my fallacy, I just needed to pass the HTTPS on; parameter via the nginx configuration.
So to avoid others pulling their hair out like I did.. triple check if you have the line
fastcgi_params HTTPS on;
Make sure it’s there in your server_block for the secure virtual host, and you’ll be good to go. It’s kinda embarrassing to admit that I didn’t have this.. but sometimes this level of public self-shaming is necessary..