Path redirects not working with proxied subdomain

What is the name of the domain?

docs

What is the issue you’re encountering

Path redirects not working with proxied subdomain

What steps have you taken to resolve the issue?

I have a subdomain “docs” which is setup with CNAME to route to an external host. Cloudflare proxy is enabled. This has been working for years.

On the docs subdomain, I have a webpage. This webpage needs to be moved to the top level domain so I need a redirect for continuity. Simple, right?

I have spent a significant amount of time trying to setup a redirect rule or page rule to successfully do this, and nothing has worked. The rule is the first to run. I have configured rules in the past without issue. I have read as many related posts on community as I can find, used AI for help, and tried hundreds of varying tweaks trying to get this to work. I’ve even left it for a few hours in case there was some DNS propagation issue, but other tests for this were near instant so I don’t think it is that.

curl -I always returns HTTP 200 which shows the Cloudflare proxy/redirect rule is not working.

What am I missing? Is it just that you can’t redirect a page from a subdomain to a top domain?

TIA

P.S. I can’t setup redirects on the external host of the subdomain.

What are the steps to reproduce the issue?

  1. Setup a DNS subdomain (CNAME) with cloudflare proxy enabled.
  2. Add a webpage to the subdomain and the top domain.
  3. Setup a redirect rule to send the subdomain page to the top domain page.

Who is the host and what is the DNS record? Can you show a screenshot of your Redirect Rule?

I don’t have proof for this but after looking into it some more I believe the issue is due to CNAME flattening and because the third-party host (GitBook) is also using Cloudflare. I also think that previous redirects I thought I was doing were actually just Gitbook automatic redirects (although I can’t be sure). I don’t have an alternative solution yet otherwise I would share.

There is a bit more context here for what GitBook is doing here: GitBook bypassing Cloudflare DNS to route traffic to their domain | Hacker News

FWIW: I was a relatively early adopter of Gitbook and recommended them to many people over the years. However, that’s all been destroyed in a matter of days. They’ve just forced a price increase on us which 10x’s our bill so we are leaving. I contacted them and they just said to consolidate our spaces. OK… I’ll consolidate them somewhere else. Feels like they are gearing up to sell which is fine I suppose, but it’s priced out of being a scalable dev friendly tool now.