I Cannot succeed to force an https connection to a sub-domain with Cloudflare


#1

Hello. My name used to be michelangelo on the old site. On the new site, it was no longer available, so I picked michel_angelo to minimise confusion.

My main site, hosted on Dreamhost, is located at “abeille-cyclotourisme.fr”.

I have not succeeded to force an https connection on it.

For testing purpose, I have created the sub-domain “test-2030.—”, I have requested a LetsEncrypt certificate for HTTPS connections and distribution via Cloudflare (free plan).

To avoid the “too many redirections” error, I have:

On the http main CP, selected, for www: “leave it alone” (no redirection)
on the HTTPS CP, I have selected for www, “copy non-secure settings”
On the .htaccess file, I have only requested a redirection to the secure version, as follows:

RewriteEngine On

RewriteCond %{HTTPS} !=on

RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

The site’s files on this test subdomain are brand new, so I assume the redirections cannot come from anything written on them.

Nevertheless, any connection attempts, whether at the http://test-2030.— address or at the
https://test-2030.— address fail with the message: “err_too_many_redirects”

If I remove the htaccess file, it works, but without redirection.

I have done all possible tests with different settings than the above, no success so far.

What am I doing wrong ? TIA


#2

hello,
this is what the cloudflare support guys suggests!
The most effective means of redirecting visitors to a secure connection is through our Always Use HTTPS feature in the Crypto section on your Cloudflare Dashboard. Alternatively if you don’t want your whole site redirected to HTTPS, you can do this on a per URL basis using page rules. While you can also redirect to HTTPS using configuration at your origin, the aforementioned redirects are processed at our edge, resulting in a quicker response and reduced requests to your server.

The "Always use HTTPS” action is the simplest option to redirect HTTP requests to HTTPS. The example shown will redirect all requests for example. com to HTTPS, but you can use any valid pattern to limit this action to a specific subdomain or directory:
best regards
craig Tutuapp APK 9Apps APK Aptoide APK


#3

Hello, il just works, right away (including for subdomains) !!! Cheers to you.