IT Nota

  • Home
  • How To
  • .NET
  • WordPress
  • Contact
You are here: Home / How To / How to Disable ETag Header on IIS 8.5 Web Application

How to Disable ETag Header on IIS 8.5 Web Application

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).

YSlow misconfigured 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.

YSlow configured ETags

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).

Further Reading

Professional Microsoft IIS 8
Configure ETags
Client Cache

February 28, 2015 Filed Under: How To Tagged With: Etag, IIS, Internet Information Services, Microsoft, Windows Server

Buy me a coffee?

Buy me a coffee If you find any of the articles or demos helpful, please consider supporting my work here, you'll have my big thanks!

Comments

  1. Tung Nguyen says

    June 16, 2015 at 1:03 am

    Thanks for your post. How can I remove Etag on IIS7.5 ?

    Reply
    • platt says

      June 23, 2015 at 10:20 pm

      Hi Tung,

      You can use the same setup and it will work the same way for IIS 7.5.

      Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Buy me a coffee Support this site
Buy Me a Coffee?

Categories

  • .NET
  • Coding
  • Cybersecurity
  • Database
  • How To
  • Internet
  • Multimedia
  • Photography
  • Programming
  • Resources
  • Review
  • Tips and Tricks
  • Use Case
  • WordPress
  • Writing

Recent Posts

  • How to Delay Shutdown or Restart on a Mac
  • How to Activate Built-in Web Server
  • SSIS Best Practice with Naming Conventions
  • How to Delay Shutdown or Restart on a Windows Server
  • How to Type Emoji Using Keyboard Shortcuts in Windows and macOS

Recent Posts

  • How to Delay Shutdown or Restart on a Mac
  • How to Activate Built-in Web Server
  • SSIS Best Practice with Naming Conventions
  • How to Delay Shutdown or Restart on a Windows Server
  • How to Type Emoji Using Keyboard Shortcuts in Windows and macOS

Tags

.NET ASP.NET Cdonts Dll Classic ASP Code Editor ETL FSharp Genesis Framework Git Google HP Asset Manager HTML5 Hugo IIS Information Security Internet Internet Information Services iOS JAMStack JavaScript Linux macOS Microsoft Microsoft SQL Server MVC PHP PowerShell Python Simple Mail Transfer Protocol Smtp Server SQL SQL Server SSIS SSMS SSRS Sublime Text Visual Studio Visual Studio Code VPN Web Server Windows Windows 8 Windows 10 Windows 2012 Windows Server

Copyright © 2011-2023 IT Nota. All rights reserved. Terms of Use | Privacy Policy | Disclosure