Caching specific Javascript and CSS files

You can configure IIS to cache specific files by extension. For example:

Select the folder where your css/js files reside and then click on Output Caching.
enter image description here

Then add the file extensions that you want to cache:

enter image description here

I don’t think you can specify which ones to cache on a per file basis unless you write an http handler module to add the appropriate headers for each file independently, but from IIS this is how is done.

Then you can verify that you are getting 304 responses using firebug / fiddler or your tool of choice.

I hope this is helpful.

Leave a Comment