We have a fairly high-volume IIS7.0 site (about 1 million requests a day), a lot of which are Images/CSS/JS.
As a quick way to reduce this, I'm considering setting the common http response header to expire web content some fixed date way in the future, and an wondering what possible disadvantages we could get with this.
Looking at the web.config change resulting from setting this, it adds:
<staticContent>
<clientCache cacheControlMode="UseExpires" cacheControlMaxAge="1.00:00:00" httpExpires="Thu, 01 Oct 2020 00:00:00 GMT" />
</staticContent>
My worry is that if we wanted to change one of the CSS/JS/Images after setting this, clients wouldn't pick up the changes and whilst images probably won't change, CSS/JS certainly will. Does that mean we should only set this on for folders containing only images? Or does this mean we need to introduce versioned URLs for our CSS/JS?
You should always cache static content (Images, CSS, JS)
Even when cached, most browsers will still politely inquire the server as to whether a newer version is available (If-Modified-Since) and the server will reply with a Not Modified. (e.g. IE defaults to "automatically check for new versions of pages")
One caveat : if there are other proxies in between your server and clients, then these proxies may elect strictly to adhere to your cache settings, and could serve 'stale' content, so you will need to apply some thought to the optimal duration of caching.