Thanks for your help. I have a similar setup, in fact I've just copied your code directly, but I'm still seeing problems. I just setup a test that demonstrates what is happening. I've created two test_ssl urls:
https://hogbaysoftware.com/store/test_ssl1
https://hogbaysoftware.com/store/test_ssl2
When viewed they should display the current request.env. For the first one (test_ssl1) I'm using ssl_required to enforce
https:// access. But when you try to access it you'll get redirect recursion and the request will eventually fail. For the second I'm not using ssl_require, so that the request will succeed and you'll be able to see the request.env.
I think the reason that I'm getting redirect recursion when using ssl_require is because in my app request.ssl? seems to always return false. That means that (with your above code) I get redirect recursion even if I'm accessing a page via
https://The implementation of request.ssl? looks like this:
def ssl?
@env['HTTPS'] == 'on' || @env['HTTP_X_FORWARDED_PROTO'] == 'https'
end
And if you access the second url above
https://hogbaysoftware.com/store/test_ssl2) you'll see that neither HTTPS or HTTP_X_FORWARDED_PROTO seem to be set even though the url is
https://... so that explains why ssl? is always returning false, and explains the recursion.
But I don't understand why those environment variables are not being set... does anyone have ideas that I should try?
Thanks,
Jesse