I found a very strange problem with one of my ecommerce applications: one day all browsers started to report a XML rendering error of the content so that the website was only partially rendered. I have never found such problem before and it took me quite a while to find the cause.
prestashop XHTML/XML rendering error
The application that started to crash was prestashop 1.5.0.17 written in PHP, but in fact it could be any web application developed on any platform, as long as it returns content-type application/xhtml+xml:
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
apache mod_pagespeed
My hosting provider changed (in fact he was taken over by another one). The new server had mod_pagespeed installed and this was the root of the problem. Despite the name of the module (mainly it speeds up returning responses), it also affects HTTP response type. Until now, the server returned
Content-Type: test/htmlHTTP response despite the fact that the mime type inside html response was xhtml, just like below:
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8"/>After the mod_pagespeed was installed, the server returned:
Content-Type: application/xhtml+xmlWhen browsers got the xhtml+xml HTTP response type, they started to validate the XML response. After the first validation error, html rendering was stopped. The bad thing about prestashop is that it doesn't support proper
xhtml/xml rendering and it uses this mime type as the default one. I hope one day I'll get to know author's intention why is it done like that.
solution
The easiest thing is to change the meta tag to return text/html for each page response. But if you don't want to touch the application code, you may just disable the mime type convertion in .htaccess:
ModpagespeedDisableFilters convert_meta_tagsWith both solutions, the browers will display the content correctly.