Hello,
We have setup 2 port configurations under our NodeBalancer. 1 for http traffic running through port 80, and another for HTTPS traffic running through port 443.
Both port configurations connect to the same Linode on port 80. We have SSL connections terminating at the Nodebalancer.
In our virtualhost config for the Linode we have the following rewrite rules (there's obviously a lot more setup in there regarding serverName, DocumentRoot etc) so for brevity here's the rewrite rules only.
<VirtualHost *:80>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ https://%1%{REQUEST_URI} [R=301,L]
</VirtualHost>
We would like all traffic to end at the URL
https://churchconnect.io/***** whether they've come from http or https, with or without www. in the hostname.
For http traffic, those rewrite rules remove the www. part of the host and point the url through to https.
This works great for the following URLs:
–
http://www.churchconnect.io »
https://churchconnect.io–
https://www.churchconnect.io »
http://churchconnect.ioThis URL just works:
–
https://churchconnect.io »
https://churchconnect.ioHowever the following URL does NOT redirect properly (notice it doesn't end at https):
–
http://churchconnect.io »
http://churchconnect.ioI realise that the redirect rule is only affecting connections made with a www. but I can't figure out how to redirect all traffic through to https without there being a infinite redirect loop occurring. I believe this is because all connections between the NodeBalanacer and the Linode are http only. I'd be happy to write specific rewrite rules under a <VirtualHost *:443></VirtualHost> directive but I don't think any connections will ever get there from the NodeBalancer.
Does anyone have any smart redirect rules that could work under this circumstance? Or do I need to setup the Nodebalancer to pass on the SSL termination directly to the Lindoes themselves by connecting over port 443 using just a TCP connection?
Many thanks,