Http and Https Redirect

I am using a domain registered on Cloudflare for my substack. Since substack necessitates the use of a subdomain www is pointed to substack. I wanted to redirect domain to www.

I added page rules. Now, [Preformatted text](http://learningbyproxy.com) seems to redirect properly but [Preformatted text]https://learningbyproxy.com provides me with an error. What am I doing wrong? I am aware that I have no A record and the traffic is not proxied through Cloudflare, is there any resolution to this?

Make the DNS record for the apex (naked domain) be like this:

Type: AAAA
Name: @, or learningbyproxy.com
IPv6 address: 100::
Proxy status: :orange: Proxied:.

With no A, AAAA or CNAME record(s) for the specific (sub-)domain, browsers won’t have anywhere to send the traffic to.

The IPv6 (AAAA) 100:: can be used as a dummy address, when you have no servers to steer the traffic to, and solely rely on e.g. Cloudflare features, such as the redirects in this case.

Together with being Proxied (:orange:), traffic will then be sent to Cloudflare’s edge.

Without a Proxied (:orange:) record, Cloudflare will never see the traffic for the given (sub-)domain.

Create the AAAA record as mentioned above.

For the HTTP ↔ HTTPS redirect, I would personally enable “Always Use HTTPS” here:

https://dash.cloudflare.com/?to=/:account/:zone/ssl-tls/edge-certificates

And then delete the second rule that you are showing on your screenshot.

1 Like

Thank you so much for the prompt response.

Worked like a charm!

Sorry to pile on some more. I wanted to redirect my old URL to the new one as well.

This also does not seem to be working. Here the main domain has its A record pointing to a server and works fine.

It seems to work ok for me. If you have just changed the redirect, it may be a previous 301 is cached in your browser. Try clearing the browser cache or incognito/private mode.

curl -I https://blog.viveksrinivasan.com
HTTP/2 301
date: Sat, 23 Dec 2023 15:10:33 GMT
location: https://www.learningbyproxy.com/
cache-control: max-age=3600
expires: Sat, 23 Dec 2023 16:10:33 GMT
report-to: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=Yx3f6x%2BZpfhh4UWeUwxtO3MlGuH44Tcj%2FOzd0q2zkjo86GwTXDHzkn6MZ2LMK6ya2yFjDYwZciJCBOAVSkExGhkt9sXqPbHr1NbFxejKKRid1Dn1mTZKF4B%2FqZPUoH6HsDCyXKxzIxH5Ar4%3D"}],"group":"cf-nel","max_age":604800}
nel: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
server: cloudflare
cf-ray: 83a188344aa852d8-LHR
alt-svc: h3=":443"; ma=86400

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.