2

I have just used the Combres library in my project to minify the css and js files, and basically optimize the page a bit. Everythere I read about the Combres I see that it sends the etags together with the resources it optimizes, and yet when I publish my project, the resources compressed by Combres doesn't have the etags on them. Is there any configuration I need to make to have this working? I am using windows azure to deploy my project (if it matters).

I would be grateful for help with this question.

domderen
  • 633
  • 9
  • 22

2 Answers2

3

You might have etags disabled by some means outside of Combres (such an http module). Depending on whether you are using IIS6 or IIS7.5 there are different techniques for removing etags. Some people have done it within the web.config under specific scenario (I think for classic app pool). You can search your web.config for 'etag' to see if there is anything in there. If its not in your web.config, search your web project for 'etag' to see if you are removing them in an IHttpModule somewhere.

Also before you spend too much time on this, you might consider forgetting etags anyways. They are sort of 'passe' and outdated. The thinking is that long reaching expiration dates on versioned files are sufficient. If a visitor/user cleared their cache there won't be any old etag to compare with anyway. If you update your combres resources its going to spit out a new versioned path which won't be compared with the old cached files' etags either. So eitherway you really don't benefit from etags with the current technology.

In fact many people go to the trouble of removing them because of their lack of usefulness and their waste of bandwidth. (Which might be why you don't have them. Some performance tuning thing you may have done in the past could have disabled them when possible.)

BenSwayne
  • 16,810
  • 3
  • 58
  • 75
  • really? That's interesting... I thought that etags are recommended to have the resoruces versioned and to minimize the bandwidth use by showing that some resouce can be taken from cache insteead of downloading it again? If not what is the other way to do that? To be honest I got interested in that topic only because I tested my website in "Google Page Speed" tester, and it told me that I sould add either etags or Last-Modified header on the resources. It seemed rather convincing that this kind of thing might allow browser to find out if the resource should be downloaded again or not... – domderen Nov 30 '11 at 06:42
  • Resource versioning is better done by changing the request path or better yet filename of the resource. This is because some caching proxy servers and other intermediaries internet devices don't understand etags, but will understand cache control headers. Also many server platforms incorrectly implemented etags rendering them not so trustworthy. Combres will change the resource set URL for you when updated and will emit the expires and cache-control headers rendering the etags redundant. – BenSwayne Nov 30 '11 at 18:16
  • Thank you for your answers. I think that now I will know how to take advantage of cache-control. Bounty sent ;] – domderen Nov 30 '11 at 21:54
0

It shouldn't matter that your files are minified, nor what utility you use to do so. ETags are controlled by the web server (IIS) but I'm not sure how that's handled on Azure, but you could use an HttpModule to customize ETags:

http://codebetter.com/karlseguin/2010/01/08/asp-net-performance-part-2-yslow/

Hope that helps.

lukiffer
  • 11,025
  • 8
  • 46
  • 70