Hi there,

There are so many issues about content types and so many and diverse answers that honestly I got overwhelmed.

I'm using XMLSiteMap (6.x-2.0-beta3) on a site with Varnish (reverse-proxy) on top, and I have many custom caching options, so I have no idea if this is due to the module, to Drupal or to the caching stuff but...

For some reason, both my sitemap.xml and sitemap.xsl show HTTP headers of Content-Type: text/html.

This effectively breaks the sitemap feature for humans. After a little search, I found out in xmlsitemap.pages.inc that the calls to drupal_set_header(), in particular the ones trying to set the Content-Type header, could be beneficially replaced by a simple:

header('Content-type: text/xml; charset=utf-8');

This hacks away the text/html problem (which must be coming from something behind drupal_set_header() but I have no time to investigate right now. This has to be done both for sitemap.xml and sitemap.xsl.

I'm leaving this bug report open but feel free to close as you please. I will try to provide more information if that helps (not sure it does since I'm only in beta3).

Great work, anyway!

Comments

ywarnier’s picture

Just an update: after a few attempts, it seems the solution works reliably for the sitemap.xml file but not for sitemap.xsl, for which I have to flush the cache each time.

That's because I also use the CDN module, which apparently tries to say the sitemap.xsl comes from my CDN, which caches most things. So I had to go to my CDN configuration and specifically exclude sitemap.* from the list of CDN'ed resources.

ywarnier’s picture

Title: Sitemap.xml content type is text/html » Sitemap.xml content type is text/html (with CDN module)

Updated title

dave reid’s picture

Category: bug » support
Status: Needs review » Postponed (maintainer needs more info)

If we are using drupal_set_header() and it's still not working then it's definitely a bug in whatever module is handling your CDN resources by not properly excluding it by default or setting the proper cache headers. Which CDN modules are you using?

dave reid’s picture

Issue summary: View changes
Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)

Closing due to lack of response.