running ySlow on a website I support, I noticed it reported that the etags are misconfigured for the site images (e.g. *.jpg, *.png, *.gif). Can anyone help explain what I have to do to get IIS7 issuing these etags correctly ?
The accepted answer by Farseeker does not work. I've tested this in IIS 7.0.6000.16386 on Windows Server 2008 Standard SP 2.
See Jeff Atwood's comment on Stack Overflow for the same question.
Etags are OK as long as you don't serve content from multiple servers. If you only serve from one server, then leave them there. They don't hurt. And if you don't want YSlow to complain about them, then click the Edit button near the Rulesets select element and edit the YSlow(V2) profile. Just uncheck the "Configure entity tags (Etags)" option.
YSlow is not complaining that they're wrong (even though that's what it says), but it's complaining that they're not needed. The only way to get YSlow to shut up about this is to disable them.
The good thing is, I just did this myself earlier today!
Open your IIS manager, click on the server, and go to HTTP Response Headers. Click the "Add..." button, and under name, enter:
(case sensitive). Under Value, enter
(thats two double quotes)
And ETags begone!
In iis 6, you can add a custom header for 'ETag' = ""
In iis 7, add an outbound rewrite rule as follows:
<outboundRules> <rule name="Remove ETag"> <match serverVariable="RESPONSE_ETag" pattern=".+" /> <action type="Rewrite" value="" /> </rule> </outboundRules>
IIS 7 will overwrite custom headers, and all other solutions proposed in various other answers regarding the same problem. Outbound rules are the only item that seems to work as it overwrites anything that's set just before it's returned to the user. This proposed outbound rule matches any server variable named
RESPONSE_ETag as long as the value of
RESPONSE_ETag has one or more characters and rewrites the value to be an empty string.
See a similar StackOverflow Question.
Please see the answer to Set Server response header in IIS7 for a partial solution. Yes, a complete solution would be really nice, but I'll take what I can get.