Skip to content

ETag is bad for clustered environment #25

asafyish opened this Issue Feb 15, 2012 · 0 comments

1 participant



I see that you calculate the etag using the file mtime (modify time), this is all nice and good when working from a single machine with a single copy of the file been served, but can be really problematic when serving from a cluster since the file is located across machines (with different mtime) and therefor different etag, causing the cached file to invalidated over and over again.

Maybe you can use md5/sha1 of the file instead of mtime, this way even from different machines in the cluster you will get the same etag.

I am aware that I shouldn't serve static files straight from node.js and use some kind of reverse proxy(nginx, varnish, squid) between node.js and the outer world.


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.