Next.js Discord

Discord Forum

sitemap headers error

Unanswered
Persian posted this in #help-forum
Open in Discord
PersianOP
I'm getting this error from google and xml file validator website..
here is my sitemap.ts code

29 Replies

I would take a look at this. Can you provide the xml outiout as well?
@Jboncz https://nextjs.org/docs/app/api-reference/file-conventions/metadata/sitemap
PersianOP
I've done the same thing
@Persian I'm getting this error from google and xml file validator website.. here is my sitemap.ts code
@joulev Click to see attachment
PersianOP
What, then why does it give me errors, can you send me that website link?
content-type is correct at the moment
PersianOP
Do you know what could be the reasons it keeps returning couldn't fetch in google search console?
i don't know. currently as far as i can see, your sitemap is perfectly fine.
PersianOP
if you go to the sitemap in your browser and open the network tab (and optionally reload again if needed), do you see the response header as application/xml?
because i do see it as application/xml
(you can also use postman for this, no need of a browser)
@joulev because i do see it as application/xml
PersianOP
that seems like too few headers huh
how about postman?
@joulev how about postman?
PersianOP
lemme try
@joulev how about postman?
PersianOP
weird
@Persian Click to see attachment
that looks 100% good, nothing wrong...
now i can only guess that either your middleware or some platform things intercepted the request and returned a different things for crawlers
still, idk honestly
but why google can't fetch it
What he said it seems fine. Def middleware or some other rule causing the issue. Throw a log message in your middleware and see if it is getting hit when you pull the site map