Cloudflare Sub-Domain Caching + GitBook
Hi there,
A couple weeks ago, I set up a CNAME record for my
https://docs.website.com
subdomain for my website to point to my GitBook documentation site. I was able to publish changes in my GitBook and see them reflected in https://docs.website.com
pretty much instantly.
However, this suddenly stopped being the case yesterday halfway through some changes I was making. It appears cached. I tried using my browser's "empty cache and hard reload" option, and I tried using different browsers too, and the changes still don't show. If I disable using a custom domain, however, I do see the changes using GitBook's url, which is how I've arrived at the conclusion that its Cloudflare caching in some fashion.
I did some Googling and learned to navigate, in Cloudflare, to "Caching" -> "Configuration" and then purging everything. I tried that and also custom purge to focus on the custom domain but somehow it seems to still be stuck.
Any help would be greatly appreciated, thank you! 🙂16 Replies
Hiya,
1. I tried disconnected the custom domain in gitbook and accessing the gitbook using the provided url and I can see the updated content. Thats what leads me to think that it might be cloudflare.
2. I have done this multiple times, yes. I tried "Purge Everything" and also "Custom Purge" on the subdomain and even tried
docs.website.com/*
in "Custom Purge" but no cigar.
I've also tried removing and re-adding the CNAME entry and its still showing to be cached.
I am wondering if perhaps I might have messed up my cloudflare config somehow because when I first added the CNAME, I set it to "DNS only" but I did subsequently set it to "Proxied" and then reverted back. It's currently set to "DNS only" but it still seems to be cached. 🤔The only way your cache settings would apply if it's proxied
If it's DNS-only and still showing outdated content, problem is gitbook
But if I remove the custom domain from gitbook, I can view the published data via the default url gitbook provides. So that suggests its working from gitbook's side, no?
It suggests the default url works
Gitbook itself is using CF, they could have misconfigured cache on their end for Custom Domains, certainly possible
Ah I see
Any suggestions on next steps for me? 🤔
If you look at the response headers, you should be able to see Cf-Cache-Status and age. If you make it change that effects css for example, either that css file shouldn't be cached, or the cache should be cleared
How would I change the caching on gitbook's side?
you can't directly unless they expose some way internally for you to do so, which I am doubtful for. But it would still be helpful for debugging/trying to see what is wrong
I have not used Gitbook myself other then helping people troubleshoot it, they don't have any way to preview stuff/for something to not be live on the Custom Domains yea?
Let me try to hit their default page now and check the response headers
This is what shows when I hit their default url (and the data shows correctly):
So its a HIT on their side.. but the data is correct though.. but if I re-add my custom domain, it shows the old data on the page..
yea they could be manually purging on each update, at least for the default url
But that means they're fine on their side right? It's when I attach my custom domain that I'm seeing the wrong data. 🤔
they'd have to be purging both the default url and the custom domain. It's hard to say much though without knowing more about how gitbook works. I'd make sure that record is dns-only, and you don't have any dns cache, and then reach out to them for support about it not updating
It definitely is set to "DNS only" yeah, I double checked. Okay, I'll try reaching out to them. Thanks friend 🙂