Monday, February 21, 2011

Add Expires or Cache Control Header to static content in IIS

After running the YSlow plugin on a site, I saw that one of the recommendations was to add far future expires headers to the scripts, stylesheets, and images.

I would like to do this, does anyone have experience with this? I am using IIS 7 and I read an article from Microsoft but am not interested in disabling caching for asp pages or images, I actually want to force caching for static content. Also, the ideal situation would not exist in code, but in the web server configuration.

So, what steps would I have to take to have every image, javascript file, and stylesheet to be cached until January 1, 2010?

From stackoverflow
  • Here is an article explaining how to set the cache control header of static content in IIS 7
    No code, just configuration steps required to get this done.

  • Can this be done in IIS 6?

    To configure content expiration

    1. In the Internet Information Services (IIS) Manager administrative tool, right-click Your Web Site, and then click Properties.

    2. In the Properties dialog box, on the HTTP Headers tab specify expiration time, and then click OK.

  • There is no HTTP Headers tab on my IIS Manager (IIS Manager 7 - XP sp2). What's wrong?? Thanks.

0 comments:

Post a Comment