apache HTTP:X-Forwarded-Proto in .htaccess is causing redirect loop in dev environment
To make it work in both environments you can combine both conditions:
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]