Chapter 9 – Advanced Web Performance Optimization
The problem with ETags is that they are constructed to be unique to a specific resource on a specific server. For busy sites with multiple servers, ETags can cause identical resources to not be cached, degrading performance. Here is an example ETag:
ETag: "10690a1-4f2-40d45ae1"
In Apache, ETags are made out of three components: the INode, MTime, and Size.
FileETag INode MTime Size"
You can configure your Apache server (in your httpd.conf file) to strip the server component out of each ETag, like so:
<Directory /usr/local/httpd/htdocs>
FileETag MTime Size
</Directory>
However, most of the websites that we tested don’t bother configuring their ETags, so a simpler solution is to turn off ETags entirely and rely on Expires
or Cache-Control
headers to enable efficient caching of resources. To turn off ETags, add the following lines to one of your configuration files in Apache (this requires mod_headers, which is included in the default Apache build):
Header unset Etag
FileETag none