Cache friendly headers

MKDoc doesn't produce any cache friendly headers, this means that using Apache 2.2 or Squid to accellerate a MKDoc site is more problematic that it should be.

For example these are the headers from a front-facing apache server:

$ ab -n 1 -v 4 -H "Accept-Encoding: gzip" http://www.mkdoc.com/
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright 1997-2005 The Apache Software Foundation, http://www.apache.org/

Benchmarking www.mkdoc.com (be patient)...INFO: POST header ==
---
GET / HTTP/1.0
User-Agent: ApacheBench/2.0.40-dev
Host: www.mkdoc.com
Accept: */*
Accept-Encoding: gzip


---
LOG: header received:
HTTP/1.1 200 OK
Date: Thu, 06 Jul 2006 14:11:54 GMT
Server: Apache
Vary: Accept-Encoding
Content-Type: text/html; charset=UTF-8
X-Cache: MISS from mkdoc.com
Connection: close
Content-Encoding: gzip
Content-Length: 4975

�
LOG: Response code = 200
..done

And this is the response direct from the back-end apache:

$ ab -n 1 -v 4 -H "Accept-Encoding: gzip" http://www.mkdoc.com:8019/
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright 1997-2005 The Apache Software Foundation, http://www.apache.org/

Benchmarking www.mkdoc.com (be patient)...INFO: POST header ==
---
GET / HTTP/1.0
User-Agent: ApacheBench/2.0.40-dev
Host: www.mkdoc.com:8019
Accept: */*
Accept-Encoding: gzip


---
LOG: header received:
HTTP/1.1 200 OK
Date: Thu, 06 Jul 2006 14:13:04 GMT
Server: Apache
Connection: close
Content-Type: text/html; charset=UTF-8

<!DOCTYPE html PUBLIC
  "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

Note that MKDoc doesn't even support HEAD requests — these simply result in the whole page rather than just the head — unless a seperate front facing apache is used as this second apache won't pass on the unrequested body.

The cacheability can be tested using the Cacheability Engine: http://www.mnot.net/cacheability/

For example: http://www.web-caching.com/cgi-web-caching/cacheability.py?query=http%3A%2F%2F www.mkdoc.com%2F

MKDoc doesn't generate HTTP headers the mod_perl way, see: http://perl.apache.org/docs/1.0/guide/porting.html#Generating_correct_HTTP_Hea ders and http://perl.apache.org/docs/general/correct_headers/correct_headers.html — MKDoc simple prints HTTP headers manually rather than using the $r way of doing it.

This caching tutorial explains everything you need to know about caching: http://www.mnot.net/cache_docs/

See also: http://www.mkdoc.org.archived.website/docs/howto/apache-22-mod-cache/ for some documentation on how to use an apache 2.2.2 server as a caching proxy for MKDoc — however this doesn't work, even when using the very latest apache 2.2.2 it doesn't cache a MKDoc site and this is probably because of the uncache friendly HTTP headers MKDoc generates.

This document was last modified on 2006-07-06 07:30:44.
MKDoc Ltd., 31 Psalter Lane, Sheffield, S11 8YL, UK.
Copyright © 2001-2006 MKDoc Ltd.