Author Topic: [BUG] Nginx + Apache Force HTTPS (Redirect Loop)  (Read 94 times)

0 Members and 1 Guest are viewing this topic.

Offline
****
[BUG] Nginx + Apache Force HTTPS (Redirect Loop)
« on: August 12, 2018, 05:05:44 PM »
Hello,

If you force https in htaccess when you are using Apache+Nginx as reverse proxy you may end up with redirect loop.

Redirect code .htaccess

Code: [Select]
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

Using the above code will end up with redirect loop

Its because Vhost of nginx ssl is not passing correct parameter for proxy_pass

Right now what we have

Code: [Select]
proxy_pass http://xxx.xxx.xxx.xxx:8181;
We need to replace http with https and port 8181 with 8443

Code: [Select]
proxy_pass https://xxx.xxx.xxx.xxx:8443;
Restart Nginx

Code: [Select]
service nginx restart