Author Topic: [Solution] Nginx + Varnish + Apache force SSL .htaccess Redirect Loops  (Read 3950 times)

0 Members and 1 Guest are viewing this topic.

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

Code: [Select]
SetEnvIf X-Forwarded-Proto "https" HTTPS=on
<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteCond %{HTTPS} !=on
  RewriteCond %{HTTP:X-Forwarded-Proto} !https [NC]
  RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IFModule>

Offline
*
Re: [Solution] Nginx + Varnish + Apache force SSL .htaccess Redirect Loops
« Reply #1 on: September 27, 2018, 03:35:21 PM »
Hi.
Where i put this code?
With this code all domains redirect to https?

Offline
**
Re: [Solution] Nginx + Varnish + Apache force SSL .htaccess Redirect Loops
« Reply #2 on: December 03, 2018, 03:59:41 PM »
Hi.
Where i put this code?
With this code all domains redirect to https?

.htaccess file.

Offline
***
Re: [Solution] Nginx + Varnish + Apache force SSL .htaccess Redirect Loops
« Reply #3 on: December 03, 2018, 04:23:24 PM »
Whenever you are using [Nginx + Varnish + Apache] or [Nginx + Apache] you need to tell Apache that a SSL request is being served by a proxy server. So use the code below to force SSL .htaccess

Code: [Select]
SetEnvIf X-Forwarded-Proto "https" HTTPS=on
<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteCond %{HTTPS} !=on
  RewriteCond %{HTTP:X-Forwarded-Proto} !https [NC]
  RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IFModule>

This work great! Is possible to do this through vhost on the server side so we don't have to add this every time?

Offline
*
Re: [Solution] Nginx + Varnish + Apache force SSL .htaccess Redirect Loops
« Reply #4 on: December 03, 2018, 09:49:38 PM »
I would suggest contacting cwp support to check it and they could integrate permanent solution if some issue exists.

main instructions
http://wiki.centos-webpanel.com/webservers-vhost-templates
http://wiki.centos-webpanel.com/webservers-update
http://forum.centos-webpanel.com/high-performance/wordpress-high-performance-instructions/
VPS & Dedicated server provider with included FREE Managed support for CWP.
http://www.studio4host.com/

*** Don't allow that your server or website is down, choose hosting provider with included expert managed support for your CWP.

Offline
***
Re: [Solution] Nginx + Varnish + Apache force SSL .htaccess Redirect Loops
« Reply #5 on: December 04, 2018, 04:24:33 AM »
Thank for the idea. I've contacted them just now. Can you also do so too and anyone else? Hopefully they will see it's important. This cause redirect issues and app breaks because of the mixed content.