Forum

http to https with cloudflare flexible ssl

ahnald
28 April 2015, 01:58
Hi,

I'm having trouble redirecting all traffic to https. Do to the nature of cloudflare flexible ssl, the encryption is only between cloudflare's server and the client, therefore "RequireSSL = yes" setting doesn't seem to work. I get a redirect loop.

With .htaccess, i am able to accomplish this using the following rules:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.domain\.com$
RewriteRule ^/?$ "https\:\/\/domain\.com\/index\.html" [R=301,L]

I tried converting this into a url toolkit rule, but I can't seem to figure it out. It either doesn't work or loops "index.html" multiple times.

Hiawatha version: 9.12
Operating System: CentOS 6 x64
Hugo Leisink
28 April 2015, 11:15
If you say that SSL is done by Cloudflare and not by Hiawatha, shouldn't that be the place than to solve this issue? Anyway, the requested UrlToolkit rule is this (I think):
UrlToolkit {
ToolkitID = some_id
Header Host ^domain\.com$ Skip 2
Header Host ^www\.domain\.com$ Skip 1
Do Return
Match ^/$ https://domain.com/index.html
}
ahnald
28 April 2015, 23:14
Thanks Hugo. That was giving me a syntax error, but you got me on the right track.
It worked after changing the final line to
Match ^/$ redirect https://domain.com/index.html


I appreciate the help.
Hugo Leisink
29 April 2015, 01:04
Uh, yes, indeed. I forgot the 'redirect'. Good to hear it works!
This topic has been closed.