Subdomains are redirecting to root domain

New to Cloudflare.

All our subdomains are redirecting to the root domain.

Using CNAME records, we put the subdomain in the “name” field, then our domain in the “target” field. Proxy status on. TTL auto.

I tried using A records, too. using the subdomain in the name field then then IPv4 address supplied by our host (Dreamhost).

Both methods redirect to our parent domain.

SSL/TLS is set to Full in order to make Wordpress work.

Any help would be appreciated. Thanks.

Have you created a subdomain (site) on Dreamhost and enabled SSL on it?

Yes. All our subdomains have been up and running for many years. They have SSL enabled with Let’s Encrypt certificates.

Do you have any page rules set to do redirects?

Or origin rules?

2 Likes

I have no rules set.

Meanwhile, Dreamhost suggested that I remove my Let’s Encrypt certificates from my domains and subdomains in their Panel then set Cloudflare to Flexible.

I did that, now nothing works. Every domain and subdomain gives me this error:

This page isn’t working

calvaryhanford .com redirected you too many times.

  • [Try clearing your cookies].

ERR_TOO_MANY_REDIRECTS

Usually pretty good support from Dreamhost in my experience, but I’d put those back soonest.

In the dreamhost control panel there are usually A records for the domains, if you use those instead is there any difference?

For fun you can point one of your domains to httpbin.org. If it gets redirected there it should show you the host header being sent. If it doesn’t get redirected and instead goes to the main website, review all the places linked above again because there’s a rule on Cloudflare making a redirection or header rewrite somewhere.

1 Like

Ok I’ll give that a try.

Yeah, Dreamhost has always been stellar for us. Longtime customers.

Really appreciate your help.

I put the Let’s Encrypt certificates back and now at least my root domain and DreamObjects are working again. Subdomains still redirect to root.

I switched one of them to httpbin as you suggested, and it worked. Admittedly, I don’t know what I’m looking at on httpbin.

Ah I probably should have clarified. My bad.

If you go to https://test.demo.dog/headers you’ll see that one of the headers in the response is host and it matches the host name in that URL which is good (the right thing). And since you just hit the page it probably will for you as well, but doublecheck by adding /headers to the URL for your domain to confirm. If it does match then I’d recommend the A record path just to be sure you’re pointed to the right origin server or service at dreamhost if that’s what’s in your DNS control panel (actually doublecheck that what you have entered matches regardless).

You can also :grey: the records to eliminate Cloudflare completely from the equation (beyond DNS resolution of course).

2 Likes

Ok, making some headway, thanks to cscharff.

Switched all the records to A using the IP provided by Dreamhost. Kept Let’s Encrypt certificates active on my Dreamhost domains.

Cloudflare SSL is set to Full.

I can access the front and back ends of all my subdomains and my cloud media files are working well with https for the first time ever.

I don’t know why the A records didn’t work earlier today…I must have had something configured wrong.

Anyway…I appreciate you helping me troubleshoot. We seem to be back in business.

Many, many thanks.

3 Likes

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