mod_cache_disk_etag caches generated content on disk if an etag response header is set; if the backend sends an already cached etag, the backend is closed and the file is sent directly.

Please note: This will not skip the backend, as it will need at least the response headers.

Use a cron-job like the following to remove old cached data, e.g. in crontab daily:

find /var/cache/lighttpd/cache_etag/ -type f -mtime +2 -exec rm -r {} \;

Have a look at mod_deflate to see this module in action.

cache.disk.etag (action)

cache responses based on the ETag response header

cache.disk.etag path;
directory to store the cached results in

This blocks action progress until the response headers are done (i.e. there has to be a content generator before it (like fastcgi/dirlist/static file). You could insert it multiple times of course (e.g. before and after deflate).


setup {
	module_load "mod_cache_disk_etag";

cache.disk.etag "/var/lib/lighttpd/cache_etag"