XML Sitemap : broken XML file [closed]

I use WP SEO by Yoast to generate sitemaps and the sitemap generated for custom types has a short hexa string at the beginning that invalidate the whole XML file :

148e2
<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="https://cabouge.tv5monde.com/main-sitemap.xsl"?>
<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">

You can see the live file here (problem solved on the live file).

The characters at the beginning of the files seams to be linked to the content, because they are different for another custom type.

I use WPSEO v1.5.2.5, but the bug was present with version 1.4.6.
It seams to be linked to my server configuration, because I cannot reproduce it on a testing server with the same WordPress code installed on it. The production server runs PHP 5.3.8.

I tried to disable all other plugins, but the issue is still present.

Any idea about where I could find the issue ?

1 Answer
1

This seams to be an issue with the header('HTTP/1.1 200 OK') function call in Yoast’s WordPress SEO plugin that is not compatible with my server configuration (Nginx with some security config in front, then apache for php processing).

In some way I do not fully understand, this php function call was forcing the server to send an HTTP/1.1 header with a HTTP/1.0 encoded body, so the end of the response header was interpreted as the beginning of the body.

Checkout the issue I have created on wordpress-seo github repo for more information.

Leave a Comment