Adding Expires Header in IIS 7

Yesterday I posted about including a favicon for every website or web application to increase performance. Another common oversight is not setting a far-future expires header expiration date. I think the Yahoo performance page says it really well why this is important:

'Browsers (and proxies) use a cache to reduce the number and size of HTTP requests, making web pages load faster. A web server uses the Expires header in the HTTP response to tell the client how long a component can be cached.'

The Yahoo article describes how to set the expires header in Apache, but I wanted to review how you would do the same in IIS7 for a designated folder or web site. Simple select the desired folder and the HTTP Response Headers action. After selecting the view you can add new headers, but for expires headers it is pretty easy. You can select the "Set Common Headers' option in the top-right corner.

This will display a dialog with two options, Enable HTTP keep-alive and Expire Web Content. Most likely the Expire Web Content checkbox is not selected. To enable the expires header check this box then set the expires time frame. For truly static content you should set this as far in the future as possible. You also have the option to enter a specific date. But most situations you will want to specify dozens or even hundreds of days.

Setting the expires header for static content can reduce the number of requests for each page by as much as 85% according to Yahoo's research. It is a very common oversight by most web masters to not configure this header for content. But setting this header adds a very tangible increase in performances as well as reducing the server load.

Share This Article With Your Friends!

We use cookies to give you the best experience possible. By continuing, we'll assume you're cool with our cookie policy.

Install Love2Dev for quick, easy access from your homescreen or start menu.

Googles Ads Facebook Pixel Bing Pixel LinkedIn Pixel