I’m a fan of Batcache, the Memcached-based WordPress full-page cache solution, but I’ve discovered that it ignores the content-type header set when the page is initially generated and re-sends all content with content-type: text/html. I posted a note about this at the WordPress support forums, but then I realized what the problem was: apache_response_headers() doesn’t return the content type, but headers_list() does.
The solution is to replace apache_response_headers() with headers_list() in the code, though headers_list() is PHP 5+ only, so it might be a while before we see a change like this committed. Still, I’ll shamelessly tag Andy Skelton (Batcache’s author) on it.
Posted April 22, 2009 by Casey Bisson
Categories: Technology. Tags: batcache, caching, fix, memcached, wordpress, workaround.
3 Comments
Comments RSS
TrackBack Identifier URI
User contributed tags for this post:
batcache (9) - batcache header (3) - batcache headers (3) - batcache content type (3) - batcache content-type (3) - anmelssex (2) - batcache blogs archived cached not (2) - bisson header (1) - batcache source (1) - correct content type (1) - send music in application contenet-type (1) - php ignoring content type header (1) - batcached (1) - memcached batcache (1) - php send correct headers (1) - batcache wordpress plugin (1) - content (1) - wordpress batcache content-type (1) - wordpress plugin send header (1) - batcache header issue (1) - wordpress status_header filter (1) - send correct content type (1) - batcache post comments (1) - batcache plugin (1) - what is fixing bot in photograhy (1) - batcache wordpress (1) - batcache and nginx (1) - nginx batcache (1) -
It’s a shame we can’t rely on PHP knowing the headers sent. That’s why I added the status_header filter. Unfortunately WordPress doesn’t have a similar function for all headers. If you want to patch with a function_exists check, I’ll commit it.
@Andy Skelton: Will do.
[...] Casey Bisson for describing the content-type patch for Batcache [...]