Method Type: User
(this means that the method is handled by the user if needed)
Entity tags (ETags) are unique identifiers that are responsible for keeping specific information about a resource and are used by the web browser to determine if set resource has already been requested and cached.
How Entity tags (ETags) work:
When a user caches a resource from a web server, he also saves its ETag. When the resource is changed, the ETag corresponding to that resource is updated. When the user tries to load the same resource the server compares the ETag the user has with the current ETag and if they do not match the server sends the resource again with the updated ETag. If the resource was not changed the server will send a 304 not modified status response which is much quicker than a complete response.
While ETags are great when the website is located on a single server, they can slow caching when the website is on more than one server. As each ETag has a unique inode/ChangeNumber when the same resource is on a few different servers, each server will add a unique inode to the ETag thus making the user cache different versions(and ETags) of the same resource.
Entity tags (ETags) provide the following Advantages (single server):
Better caching and faster load times
Lower server load and used bandwidth
Entity tags (ETags) have the following Disadvantages (multiple servers):
Slower load times and caching multiple times the same resource.
Higher server load and used bandwidth
There are two ways to deal with ETags when you are hosting your website on multiple servers.
The first thing you can do is to reconfigure the ETags so they do not contain an inode value. This can be done via the Apache config file. You can access it via SSH by navigating to:
Add the following lines to the file:
<Directory /usr/local/httpd/htdocs> FileETag MTime Size </Directory>
The second way to deal with ETags is to remove them completely and leave the caching to cache control headers. This will also reduce the size of the HTTP headers in the request/response pairs.
In order to do that you will need to add the following lines to your Apache config file:
Header unset Etag FileETag none