Subdomain traffic still being routed to old CNAME aliased domain instead of new A record

I have a subdomain, which previously had a CNAME record for

We removed that record and added a A record(with DNS Proxy enabled) so it points to our own servers.

But Cloudflare is still routing traffic to the old CNAME record and our server is not receiving any traffic.

Previously, We had not enabled DNS proxy for this CNAME record because that breaks the integration in gitbook.

Right now, We are being sent to

and the A records are,

which makes me believe that somehow even though I didn’t turn on DNS Proxy when I had a CNAME record there, It turned on DNS proxy on it’s own.

Now, I see these cloudflare IPs and because of some bug, The traffic is being sent to gitbook’s servers.

Please look into this.


The redirect is not getting done at CloudFlare, but actually getting done on your origin Server or any server behind CloudFlare.

there are two redirects:

  1. =(302)=> (HTTP to HTTPS)
  2. =(302)=>

(1) is getting done in CloudFlare
(2) is not getting done in CloudFlare, but on the server behind.

I am not sure if that is true. We are only proxying https traffic back to the actual application running on that server.

This is the NGINX config from that server, and running curl https:// was returning the correct response.

Also, After doing a %s/docs-v2/docsv2(i.e. Changing server_name from to operation on the config, It now works perfectly fine.

Seems like th core problem is that you want to serve your GitBook pages with an custom domain.
To do so please follow GitBooks docuimentation.

Custom domain setup on GitBook
This should be the place to configurate it:

DNS configuration

These two links should make sure your custom domain will work.
But before you CNAME a custom domain you have to set it up on GitBook to accept it

1 Like

I am sorry for the confusion.

We were using gitbook integration with a custom domain at in the past and now we are switching from that to our own docs thing.

The problem here is, Even after removing the CNAME record for → and adding a A record for, Traffic was still being sent to gitbook instead of us and this is after waiting ~1 hour after the record change. The DNS entry for this record was definitely updated and it was still sending us to gitbook.

Ok … now I got it.

Has the CNAME been proxied before?
Is the new A-Record proxied now?

If the CNAME (what it was before) was NOT proxied (:grey:) it is pretty sure cached localy and takes longer to be updated.

Yes, I don’t believe it is the problem here…

I have added back the A record if you want to test and It is still sending us to gitbook.

Yes, A record is proxied.

Yes, For a brief moment few months back when we were trying out gitbook but we disabled proxy on that record soon after that and hasn’t been proxied since then.

Have you set up any PageRules or anything like that?

Somewhere mostly at the target of is a redirect implemented to redirect with a 302 to GitBook. As it is a 302 is actually is still redirecting as 302 redirections are not cached at client side.

We have not setup any page rules(or anything of that sort) for this subdomain.

The 302 you are seeing is because we removed the Domain from gitbook so now gitbook redirects with a 302 to their own subdomain they have reserved for us.

If we add a domain like, in gitbook, You will not see that 302 anymore. You’ll just see the same content as at

So the domain is still pointing to GitBook?
If you point the domain to GitBook GitBook will redirect it. So if you want to use this Domain at your own server you have to point it to your own server.

I really cant help you with that little informations.

Could you please post a screenshot from your DNS section in CloudFlare so I can have a look at it?

This is the only record we have for

It is pointing to our server and the traffic is still being sent to Git book. This shouldn’t happen because we are not pointing this domain to Gitbook at all.

And since we do not have a domain configured in gitbook anymore, Gitbook is redirecting requests from to

Ok thats weird. I would recommend opening a Ticket and post the Ticket ID here so people can have a look at.

There apparently is nothing I can do anymore. Your Subdomain indeed in pointing to an IP from Digital Ocean AFAIK and not to GitBook.

Thank you so much for the interaction, This was great! :))

I could open a ticket and follow it up and so on or I can just change to docsv2 and move on.
This has to be a internal problem at cloudflare that they’ll realize at some point and fix. I am not burning more time on this.

Have a nice day! :slight_smile:

1 Like