Fix for google search console 'sitemap could not be read'

Fix for google search console 'sitemap could not be read'

Another little fix that’s taken me weeks to figure out.

  • I have a site I’ve built in SvelteKit.
  • I have a route at /sitemap.xml which just generates some XML for the sitemap.
  • When I submitted the sitemap to Google search console it kept giving me ‘Sitemap could not be read’ or ‘Couldn’t fetch’.
  • Loading the sitemap myself was fine, checking the sitemap in 10 different sitemap checkers was fine.
  • I’m on DigitalOcean app engine, which is not important. DigitalOcean app engine uses Cloudflare, which is important.

The smoking gun

If you want to check your problem is the same as my problem, run this command in a shell.

1
curl -A "Googlebot/2.1 (+http://www.google.com/bot.html)" -I <your_sitemap_url>

If you see something like this, it’s bad.

1
2
3
4
5
6
7
8
9
10
11
12
13
HTTP/2 200 
date: Thu, 09 Oct 2025 13:14:07 GMT
content-type: text/xml                   <<<< THIS
cf-ray: 98be23a60d7b93d8-LHR
vary: Accept-Encoding
last-modified: Wed, 08 Oct 2025 16:50:54 GMT
etag: W/"3922-1759942254789"
cache-control: private                   <<<< OR THIS
x-do-orig-status: 200
cf-cache-status: MISS
set-cookie: __cf_bm=BZsTF9RpKjnsFvn5wesBHi07A7TQXQvpAA9ScRkDrT8-1760015647-1.0.1.1-OVeuZbQ6jhI5pcpmazQV1v2qCnG8r9HH4vvpL_2ZZcKiQzQFSxOcyDjDBml55tSX8wbWUM4pri_J8aQDLX3NLIi_rqM7FsfeGqYqd7q7D6E; path=/; expires=Thu, 09-Oct-25 13:44:07 GMT; domain=.inventronix.club; HttpOnly; Secure; SameSite=None
server: cloudflare
alt-svc: h3=":443"; ma=86400

Two issues here:

  • Your mime type for the page is text/xml, it should be application/xml.
  • The cache control says private, which tells GoogleBot that this page requires auth of some sort / is user dependent.

If you’re thinking ‘but I set my content header to application/xml and my page is public?’, you’re probably right. For some reason Cloudflare sees the .xml bit on the end of the URL and mangles your header and mime type.

Thanks Cloudflare!

Fix

The fix is to simply change the URL of the sitemap page from /sitemap.xml to just /sitemap (or whatever, as long as it doesn’t have a file extension). Change that, redeploy and do the same curl again. You should get something like this:

1
2
3
4
5
6
7
8
9
10
11
12
HTTP/2 200 
date: Thu, 09 Oct 2025 13:22:02 GMT
content-type: application/xml; charset=utf-8                 <<< NICE!
cf-ray: 98be2f3b0cc6cd3e-LHR
cache-control: public, max-age=3600                          <<< NICE!
x-do-app-origin: 6c9edd41-9867-4d19-ac37-8485b1cb8873
x-do-orig-status: 200
last-modified: Thu, 09 Oct 2025 13:22:02 GMT
cf-cache-status: MISS
set-cookie: __cf_bm=ajGD4sdMsBe0hThUfeAN_AnoYPWg3L1QfLAbl_AsevA-1760016122-1.0.1.1-amJNeMHbWrtLIn0.f_CeGO6KUzGkkeR4t_jEIVaxIc29tn4Y08xvSeL_tjAyGWwPjbSzAR2VcCOjO1_UapezsS9Lys1kEjx3B1J7x5bOIRM; path=/; expires=Thu, 09-Oct-25 13:52:02 GMT; domain=.inventronix.club; HttpOnly; Secure; SameSite=None
server: cloudflare
alt-svc: h3=":443"; ma=86400