Node blalancer redirect

I’m using a Linode node balancer and I’m having issues with redirect to https.

My current .htaccess

IfModule mod_rewrite.c
RewriteEngine on
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]

RewriteCond      %{HTTP:X-Forwarded-Proto} !https
RewriteRule      ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R=301,NE]


Had to take out &lt and &gt due to BB code.

The X-Forwarded-Proto line is supposed to detect how the client is connecting to the node balancer and then redirect to https if it’s http. It does seem to work but I’m having occasional issues where it isn’t.

I’ve been on the site http and didn’t redirect at all. I type in https, get the login screen, then login and it takes me to the http site. It’s very odd.

Is there something incorrect in my .htaccess? I need it to redirect to https 100% of the time.