Redirect http to https on cwp7 [Nginx + Varnish + Apache]

Redirect http to https on cwp7 [Nginx + Varnish + Apache]

When using [Nginx + Varnish + Apache] or [Nginx + Apache] you need to tell Apache that an SSL request is being served by a proxy server. So use the code below to force SSL in .htaccess

 SetEnvIf X-Forwarded-Proto "https" HTTPS=on

  RewriteEngine on
  RewriteCond %{HTTPS} !=on
  RewriteCond %{HTTP:X-Forwarded-Proto} !https [NC]
  RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]