misterbisson
Member
Posted 2 years ago #
Any content that's cached by batcache gets re-sent with a text/html content-type header, regardless of the original header.
Note the header given here (a live site using Batcache):
http://collingswoodlib.org/index.php?bsuite_mycss=print
Despite the explicit text/css header being specified here:
http://plugins.trac.wordpress.org/browser/bsuite/trunk/bsuite.php#L963
I've confirmed this with other content served through Batcache, including things like this image:
http://collingswoodlib.org/files/2008/11/cropped-collingswood2.jpg
http://wordpress.org/extend/plugins/batcache/
misterbisson
Member
Posted 2 years ago #
It looks like apache_response_headers() isn't returning the content-type header, but headers_list() does.
I've solved the problem by changing these lines:
if ( function_exists( 'apache_response_headers' ) ) {
$cache['headers'] = apache_response_headers();
To something like this:
if ( function_exists( 'headers_list' ) ) {
$cache['headers'] = headers_list();
randompage
Member
Posted 2 years ago #
yups. it broke robots.txt if i generate it via wordpress engine.
so i add some codes as suggested by misterbisson :
$cache['headers']= array();
if ( function_exists( 'apache_response_headers' ) ) $cache['headers'] = array_merge($cache['headers'], apache_response_headers());
if ( function_exists( 'headers_list' ) ) {
$heads= headers_list();
if (is_array($heads))
foreach ($heads as $ahead) {
list($head_name, $head_value)= explode(":", $ahead);
if ($head_name) $cache['headers'][$head_name]= trim($head_value);
}
}