views:

1665

answers:

7
+1  Q: 

configuring e-tags

I am using Yslow as a simple speed benchmarking tool and I came across a really confusing concept. The E-tag

So the main problem is : How do I configure E-tags? my grade in yslow says:

There are 19 components with misconfigured ETags

* http://thehotelinventory.com/media/js/jquery.min.js
* http://thehotelinventory.com/media/js/jquery.colorbox.min.js
* http://thehotelinventory.com/media/js/easyslider.min.js
* http://thehotelinventory.com/media/js/jquery.tools.min.js
* http://thehotelinventory.com/media/js/custom.min.js
* http://thehotelinventory.com/media/js/jquery.validate.min.js
* http://thehotelinventory.com/media/images/colorbox/loading_background.png
* http://thehotelinventory.com/media/images/productheaderbg.jpg
* http://thehotelinventory.com/media/images/buttons/field-bg. //etc

I browsed through the developer.yahoo.com guidelines on website optimization yet I can't really understand the thing with e-tags

A: 

Entity tags are a feature of the HTTP protocol, see http://www.ietf.org/rfc/rfc2616.txt

Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the ETag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. The definition of how they are used and compared as cache validators is in section 13.3.3. An entity tag consists of an opaque quoted string, possibly prefixed by a weakness indicator.

just somebody
+2  A: 

Think of E-Tags as a sort of hash. When a browser makes a request for a resource, it sends along the E-tag of the file version it has cached. If the server decides that the files are similar enough (there are "strong" and "weak" versions of E-Tags so it's not always a simple comparison check) it will send a "304 Not Modified" response to the client, rather than the resource itself. This translates into a speed boost, since it prevents bandwidth from being wasted on unchanged files.

E-Tags are sent via HTTP headers.

There's a good example of E-Tags at work (and also how to disable them for Apache) here: http://www.askapache.com/htaccess/apache-speed-etags.html

ShZ
A: 

Go straight to the source, YSlow provides guidance on all of it's advice, including how to configure ETags.

Ben Marini
A: 

wikipedia is the man's best friend:)

http://en.wikipedia.org/wiki/HTTP%5FETag

Basically a hash as ShZ said, that should be unique or almost for a file.

Quamis
A: 

The best way to configure your ETags is to remove them. For static files, far-future expiration dates are a much better approach.

The way to remove them depends on the web server you're using. For IIS 7, it can be done with a simple HttpModule.

RickNZ
+1  A: 

This page shows how to disable ETags for IIS and this page shows how to do it for Apache.

Bert Lamb
+1  A: 

Assuming you are running Apache...

You can set up a simple ETag like this:

FileETag MTime Size

If you have multiple servers, you want to disable ETags.

FileETag None

Put the above code in your httpd.conf (if you have access), otherwise you can put it in .htaccess.

philfreo