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
nir4
nir4•4mo ago
1. Try accessing it via its .gitbook.io subdomain 2. It's not clear that you purged it to me, did you? (deeplink)
K-Dizz
K-Dizz•4mo ago
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. 🤔
Chaika
Chaika•4mo ago
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
K-Dizz
K-Dizz•4mo ago
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?
Chaika
Chaika•4mo ago
It suggests the default url works Gitbook itself is using CF, they could have misconfigured cache on their end for Custom Domains, certainly possible
K-Dizz
K-Dizz•4mo ago
Ah I see Any suggestions on next steps for me? 🤔
Chaika
Chaika•4mo ago
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
K-Dizz
K-Dizz•4mo ago
How would I change the caching on gitbook's side?
Chaika
Chaika•4mo ago
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?
K-Dizz
K-Dizz•4mo ago
Let me try to hit their default page now and check the response headers
K-Dizz
K-Dizz•4mo ago
This is what shows when I hit their default url (and the data shows correctly):
No description
K-Dizz
K-Dizz•4mo ago
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..
Chaika
Chaika•4mo ago
yea they could be manually purging on each update, at least for the default url
K-Dizz
K-Dizz•4mo ago
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. 🤔
Chaika
Chaika•4mo ago
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
K-Dizz
K-Dizz•4mo ago
It definitely is set to "DNS only" yeah, I double checked. Okay, I'll try reaching out to them. Thanks friend 🙂
Want results from more Discord servers?
Add your server
More Posts