Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IIS CSS Caching

Tags:

css

iis

iis-6

When we are developing new sites or testing changes in new ones that involve css after the new code is committed and someone goes to check the changes they always see a cached version of the old css. This is causing a lot of problems in testing because people never are sure if they have the latest css on screen (I know shift and clicking refresh clears this cache but I can't expect end users to know to do this). What are my possible solutions?

like image 648
Greg Avatar asked Sep 22 '08 20:09

Greg


2 Answers

If you're serving your CSS from static files (or anything that the query string doesn't matter for), try varying that to ensure that the browser makes a fresh request, as it will think that it's pulling a completley different resource, so have for example:

"styles.css?token=1234" in the CSS reference in your markup and change the value of "token" on each CSS check-in

like image 54
Rob Avatar answered Sep 22 '22 18:09

Rob


In your development environment, set the Expires header much lower. In your Production environment, set it higher, and then set it low about a week before you do your release.

like image 36
Tom Ritter Avatar answered Sep 19 '22 18:09

Tom Ritter