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?
Here is what you need to remember while caching static resources on CDN or local cache server: Use Cache-control HTTP directive to control who can cache the response, under which conditions, and for how long. Configure your server or application to send validation token Etag. Do not cache HTML in the browser.
To configure an Expires header in IIS, right-click the Default Web Site in the Computer Management Console, select Properties, then click the HTTP Headers tab, which Figure 4 shows. Select the Enable Content Expiration check box and choose your expiration preferences.
To use cache-control in HTML, you use the meta tag, e.g. The value in the content field is defined as one of the four values below. HTTP 1.1. Allowed values = PUBLIC | PRIVATE | NO-CACHE | NO-STORE.
Can this be done in IIS 6?
To configure content expiration
In the Internet Information Services (IIS) Manager administrative tool, right-click Your Web Site, and then click Properties.
In the Properties dialog box, on the HTTP Headers tab specify expiration time, and then click OK.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With