Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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 ?

share|improve this question

7 Answers 7

up vote 5 down vote accepted

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.

share|improve this answer
    
This answer is no longer correct/relevant. You can change ETags in iis 7+ by adding an outbound rule as seen in my answer serverfault.com/a/528346/78230 –  AndrewPK Dec 23 '13 at 19:27

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:

ETag

(case sensitive). Under Value, enter

""

(thats two double quotes)

And ETags begone!

share|improve this answer
    
As others point out, you should only remove ETags if you know you need to; in many cases, this won't be the case. –  Bobby Jack Apr 8 '10 at 11:42
1  
That may be the case, but the fact of the matter is that the answer correctly answers the question. –  Mark Henderson Apr 8 '10 at 11:56
1  
The question asked 'how do I get IIS7 to issuie these etags correctly?'. Your answer was to stop issuing ETags altogether, which is a possible performance hit, and likely unnecessary (there was no mention of CDN-usage in the question). –  Bobby Jack Apr 8 '10 at 12:10
2  
@Bobby: the OP is implicitly asking "how do I get IIS7 to issue these etags correctly as defined by YSlow?". and the only "correct" configuration, as far as YSlow is concerned, is to disable them. –  Kip Sep 15 '10 at 19:38
1  
@Kip, no, the implicit part is implicit, and you cannot guess it. But presuming that the OP is a reasonable person, he probably wanted to say "according to YSlow the configuration seems to be suboptimal, how can I make it optimal?" - And then this answer is a bit funny. It's like "why does my unit test complain?" - "Just delete the unit test, and it won't complain anymore!" –  chiccodoro Jun 15 '11 at 8:09

See a similar StackOverflow Question.

share|improve this answer

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.

share|improve this answer
5  
+1 YSlow complains about a lot of things don't affect "mere mortal" web sites. (No YSlow, I don't have and don't need a CDN. Please quit whining already.) –  Gerald Combs Feb 8 '10 at 21:21
    
True about the rule set change. –  MikeJ Jan 4 '12 at 17:10

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.

share|improve this answer

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.

share|improve this answer

Better use this :

<outboundRules>
  <rule name="Remove ETag">
    <match serverVariable="RESPONSE_ETag" pattern="(.*)\:(.*)" />
    <action type="Rewrite" value="{R:1}" />
  </rule>
</outboundRules>
share|improve this answer
3  
Welcome to Server Fault! While the magic bytes are certainly nice, it's awesome for other people reading it if you explain why this is correct. –  Falcon Momot Nov 8 '13 at 9:30

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.