Understanding why your updated images don't immediately get served to Browser Clients
This is a complex topic, but here's a cursory explanation:
The Web Server, in this case IIS, sets Content Expiration info and information about then things are modified in the HTTP Headers. If you ask for something from the Web Server, but you say "only if modified since..." they will pass back Not-Modified HTTP Headers to the Browser. You can see this even when hitting F5 to refresh the browser if you use a tool like ieHTTPHeaders (http://www.blunck.info/iehttpheaders.html) . Look at IE Content Expiration in the Properties.
Most folks like to have a /images folder that has SEPARATE Content Expiration settings and static content, or many levels of image volatility.
You have a few possible solutions:
· Have volatile (often changing) images stored in one folder and set to expire immediately or on your specific schedule.
· Have the Browser user press CTRL-F5 to blow through the cache
F5 in IE will NOT fetch updated images until they expire. Pressing CTRL-F5 will keep the browser from including If-Not-Modified which is equivalent to saying get it anyway.
· Check the GET requests of your images in the HTTP Headers to see when they will expire...then wait. ;)
· If you are generating the images yourself (dynamically generated on the server side) then you control the headers, so you can force updates by writing the appropriate headers yourself.
Notice in this screen shot that even though I pressed F5, the Web Server responded This image hasnt been modified!
Even more, this request from the browser specified Only give me this image if its been modified since a certain date.
The moral of this story is, you'll never know the WHY of the behavior of your system unless you know both the HOW of the HTTP Spec and the QUIRKY HOW of the browser whose behavior you're examining.
About Scott
Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.
About Newsletter
Comments are closed.