If you analyze a classic ASP or ASP.NET web application using YSlow, you’ll notice that more often than not (if not always), you’ll get an F grade on the Configure entity tags (ETags).
In general, you can ignore this if you’re using IIS 7 or later as it’s not affecting much of IIS performance tuning. However, if you’re nitpicky about the test result, this can be fixed easily.
The easiest fixed to do is to remove the ETag header from the HTTP response on IIS. And here’s how you can do that easily just by tweaking the web.config file under the application root directory.
<configuration> ... <system.webServer> ... <staticContent> <clientCache setEtag="false"/> </staticContent> ... </system.webServer> ... </configuration>
Sometimes you’ve already had an entry for clientCache, then you can just add in the setEtag attribute within the element like so:
<staticContent> <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="7.00:00:00" setEtag="false" /> </staticContent>
Clear your browser’s cache and run YSlow test again, and this time you should see grade B or better on the Configure entity tags (ETags) section on the YSlow result.
Caveat
This solution works at the application level so it may not be practical, so it has to be done for each application you want to have Etag disabled. If you have more than a dozen applications on the server. In which case, you want to implement a solution targeted at the server level instead (using URL Rewrite).
Thanks for your post. How can I remove Etag on IIS7.5 ?
Hi Tung,
You can use the same setup and it will work the same way for IIS 7.5.