Welcome! Log In Create A New Profile

Advanced

Re: Will nginx support HTTP Etag ?

April 14, 2009 11:36AM
2009/4/14 Xia Qingran <qingran.xia@gmail.com>:
> Hi,
> After reading http://wiki.nginx.org, I find out that nginx has not the
> offical support for the HTTP Etag,
> http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.19 . I
> want to know whether the future version of nginx will add this
> feature.
>
> My website is taking use of nginx to run static files server including
> lots of Javascipt and CSS files modified frequently. Now I set a very
> short expires time like, expires 1h, to renew the client cache as soon
> as possible.
>
> But I think it is not a good solution. It wastes my network bandwidth
> if I do not modify the static files. Etag will do it better because it
> can renew the client's cache immediately. Moreover the implement of
> this feature is not very hard. One simple method of generating the
> ETag is based on the the size and last modified time of the file.


Do what (I do) and other large sites do.

Put a query string parameter on the file. It will make the browser
treat it as a fresh one.

foo.js
foo.js?v=1
foo.js?v=2

(Somewhat thanks to Flickr for validating this concept)

It is also CDN friendly, we use Akamai and it allows us to not have to
purge the cache constantly.

We use our subversion revision number for the ID that goes in the v=
param. This automates it and there is no way for the file to be
updated without going through subversion anyway; it's kind of a
win/win. I find this to be easy and require less configuration.
However, if you don't have an automated system you'll have to remember
when you update your .js file to go update the calling page (which
might be just as simple too)

Yahoo discourages ETags as well depending on your usage model:

"If you're not taking advantage of the flexible validation model that
ETags provide, it's better to just remove the ETag altogether. The
Last-Modified header validates based on the component's timestamp. And
removing the ETag reduces the size of the HTTP headers in both the
response and subsequent requests."[1]

[1] http://developer.yahoo.com/performance/rules.html
Subject Author Posted

Will nginx support HTTP Etag ?

Xia Qingran April 14, 2009 05:33AM

Re: Will nginx support HTTP Etag ?

Anton Yuzhaninov April 14, 2009 06:04AM

Re: Will nginx support HTTP Etag ?

Phillip B Oldham April 15, 2009 03:37AM

Re: Will nginx support HTTP Etag ?

Anton Yuzhaninov April 15, 2009 05:52AM

Re: Will nginx support HTTP Etag ?

mike April 14, 2009 11:36AM

Re: Will nginx support HTTP Etag ?

Xia Qingran April 14, 2009 10:53PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 187
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready