homepage Welcome to WebmasterWorld Guest from 54.198.224.121
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Accredited PayPal World Seller

Home / Forums Index / WebmasterWorld / Webmaster General
Forum Library, Charter, Moderators: phranque & physics

Webmaster General Forum

    
I still don't understand E-Tags
mike2010




msg:4260760
 8:05 pm on Jan 31, 2011 (gmt 0)

Even after reading all this

[en.wikipedia.org...]

I still don't understand them..

Basically, I just want my site to be optimized with checkmarks on this site after its evaluated -

[webpagetest.org...]

Could I just have a small example on what e-tags are specifically referring to on a site, and what is needed to be done to fix them ?

I appreciate it much

[edited by: tedster at 10:10 pm (utc) on Apr 29, 2011]
[edit reason] maintenance [/edit]

 

Receptional Andy




msg:4261072
 10:27 am on Feb 1, 2011 (gmt 0)

You may be familiar with "last modified" headers - a way preventing repeated downloads of files that haven't changed since they were last requested. Knowing this allows browsers to use a locally cached copy, which will significantly speed up user experience.

Etags are a similar mechanism, but instead of using dates and times, use an identifier instead - which gives a bit more flexibility that just a timestamp. This can be useful if for some reason you can't get implement correct last modified dates.

The way etags work is your server can be configured to send the tag along with requests for images etc. When your browser re-requests the file, it also sends back the tag. If they match, the cached version is served instead.

How it's set up, and whether it's necessary depends on your server. Bear in mind that automated tests will tend to rely on general best practice rather than specifics for your site.

If you have some budget to increase speed, I'd recommend serving media files via a CDN - there are a number of low cost options for this these days, and your CDN provider would handle the best approach to caching for you. It would also reduce your own server laod and speed up the parts you were still handling yourself.

phranque




msg:4261148
 1:41 pm on Feb 1, 2011 (gmt 0)

the actual "mechanism" is:
- the server sends a HTTP response header with the requested resource like:
Etag: "nnnnnnnn"

- if the browser caches that resource it would also maintain the Etag for that resource.
- the next time that browser requests that resource it also sends a HTTP request header like:
If-None-Match: "nnnnnnnn"

- if the server can match Etags with the current version of that resource, instead of responding with that resource it will send a HTTP 304 Not Modified status.
- then the browser will use the cached resource instead of having to wait for another copy.

mike2010




msg:4261963
 11:49 pm on Feb 2, 2011 (gmt 0)

thx guys. Very well explained.

now, how about enabling this feature. Does it need to be done through apache httpd config or something ?

phranque




msg:4261976
 12:35 am on Feb 3, 2011 (gmt 0)

the FileETag Directive [httpd.apache.org] is one of the core apache features and can be specified in the server config or .htaccess files.

mike2010




msg:4262971
 11:28 pm on Feb 4, 2011 (gmt 0)

so for .htaccess , I would just place

FileETag INode MTime Size

somewhere near the top ? I don't see any specific examples... Or any guides online.

phranque




msg:4262992
 2:34 am on Feb 5, 2011 (gmt 0)

it depends on what determines a "significant" change in content for your specific application.
if you are basing it on all 3 options (inode, last modified and file size) it would be simpler to use:
FileETag All

if you are using a CDN, for example, the inode would be different on each server, so you might want to use:
FileETag -INode

you also want to make sure this directive is designated in the proper Context [httpd.apache.org].

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / WebmasterWorld / Webmaster General
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved