Can't get "Always Use HTTPS" to work with all urls

I wish to redirect (301) this url:

http://www.mydomain.com/

to:

httpS://www.mydomain.com/

and I have tried both checking “Always Use HTTPS” in “SSL/TLS>Edge Certificates” and/or adding a “Page Rule” for:

*mydomain.com/*

and it works for:

http://mydomain.com/
mydomain.com/

but not:

http://www.mydomain.com/ or any other subdomain (I get through but not with https)

It is as if the rule doesn’t match subdomains. But even when having the rule as exactly http://www.mydomain.com/ it wont work. Not www.mydomain.com/ or *.mydomain.com/ either.

I can add that I have added a CN * record to point all subdomain-requests to another domain. Is that the problem? Can I get this to work somehow anyway?

If you posted the actual domain, people could actually take a look :wink:

Your “www” record is not proxied, hence none of the Cloudflare settings will apply. You need to switch it to :orange:.

I see, so I can’t get this to work using CNAME * (DNS only) then I assume?

Cant you toggle that record? Can you post a screenshot?

You mentioned you already set the global setting, hence you dont need the first page rule.

Also, the screenshot was referring to the record. Simply toggle it as mentioned and it should work.

Which record do you mean? I don’t have a record for www, only *, since I wish all subdomains to redirect. When only having this record + proxied it still don’t work and I can’t have “*.domain.com” or “*” proxied it seems. I have reverted back to having a A @ record and a CNAME * but now I can’t get that to work either. Now I get “DNS Lookup Failed” whenever I have a subdomain… dammit

Alright, that wont work. You cannot proxy a wildcard and hence cannot redirect it either. You need to remove the wildcard and specify whatever hosts you want individually.

Yeah but it worked ok for a while. It was just the http://sub.domain.com that didn’t work. I should have left it at that. The thing is I was proxying the A @ record and rewriting it to “https://www”, which then the CNAME * record routed to my domain alias (w/o need for proxying which is only available for Enterprise). But when entering “http://sub.domain.com” this was not proxied and hence not redirected to https, which I could have lived with. But now suddenly almost everything stopped working for no apparent reason. Weird.

Anyhow, you need to create the record manually and proxy it.

Thanks for your help! It work now. Finally! =)