Custom etag generation

Viewed 3140

How can I configure an apache or nginx server to send Etag headers using an algorithm of my choosing (i.e. not involving inode, mtime or size)? Is there any alternative to compiling a new C module?

2 Answers

There are some comments in this PR that could address what your looking for. It isn't an algorithm of your choosing, but it is MD5, which is pretty solid.

You'll note that they present two options.

  1. Use the modified date of the file, but have a build process artificially mutate the modified date of the file based on a hash of the file. Then this modified date can be included in the ETag header calculation (don't use it as the Last-Modified header, as it may be in the future).
  2. Use the Content Digest feature of Apache to get an MD5 hash of the file as a header. You can then manipulate that as needed.
Related