[BlueOnyx:21983] nginx issues

Maurice de Laat mdlaat at muisnetwerken.nl
Thu Apr 26 11:45:26 -05 2018


Hi list,

I am testing the nginx ssl proxy (thank Michael for this new feature!).

I notice that some websites fail to load after the nginx proxy is 
enabled. Reason for this is that they all have a config to force the 
visitor to a https connection. Because apache now only sees a http 
connection, it keeps responding with a redirect to the https version. 
The browser follows this redirect, hits nginx which makes a http 
connection to apache which results in the same redirect, causing a loop.

In my situation, I can divide these "problematic" websites into two 
categories:

a) wordpress sites, with a force https setting in wordpress itself

b) non wordpress sites, with a force https setting in a .htaccess file

Now for type a websites, I have found a method to systemwide resolve 
this issue:

I have created a file /etc/httpd/conf.d/nginx-ssl-proxy.conf which only 
contains
SetEnvIf X-Forwarded-Proto "https" HTTPS=on

et voila: all wordpress sites are working again.

@Michael: If it can do no harm, this little addition might be useful for 
everybody?

For type b websites, I have yet to find a system wide solution. I can 
solve it by editing all single .htaccess files, adding a rewriterule 
condition:
RewriteCond %{HTTP:X-Forwarded-Proto} !https

If someone knows a systemwide solution, so I don't have to edit all 
single .htaccess files, please let me know :)

Kind regards,

-- 
Maurice




More information about the Blueonyx mailing list