Copy link to clipboard
Copied
I've recently come across different cache behavior from flash player. In the past, I would change files on a server, flash would make requests, and get the new files. Subsequent requests, without changing server files, would simply get a 304/Not Modified response from the server.
The key was that flash player would always make the request from the server (in the absence of some "expires" cache policy in the response headers).
However now flash player does not make subsequent requests from the server. It seems flash player/browser/system is applying a default "time to live", depending on the browser/flash player. I include browser/system since testing IE8 and Chrome reveals that the browser does not even request the SWF from the server within an arbitrary time (IE8 much longer than Chrome).
Cache-related response headers specify a Cache Date, and ETag and a Last-Modified. Here's an example set of response headers (seen using Fiddler) from a file that is not subsequently requested by flash for a long time:
HTTP/1.1 304 Not Modified
Last-Modified: Tue, 29 Mar 2011 16:27:23 GMT
Accept-Ranges: bytes
ETag: "99ad132f2eeecb1:36aa"
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
Date: Wed, 30 Mar 2011 15:36:45 GMT
There's nothing in there that specifies an "expires" entity... so why wouldn't flash always make a server request? Is the IE cache to blame? It's possible that server admins have changed the headers and I'm just seeing a result of that. But I don't see anything in the example headers above that would cause flash to fail to make requests.
Of course the work-arounds are always clearing cache (a pain for clients and me) or appending timestamp query string onto request (bad idea; doesn't work on all servers, can't easily apply to all requests, a hacky way to do things, etc...) but are there any other thoughts?
Thanks
Copy link to clipboard
Copied
Did some more digging and looks like our server cache headers did indeed change recently. And since there's no cache expiration, the browser/flash does what it wants. Here's a snipped explanation from Fiddler's "Caching" response tab on one of the HTTP/200 responses:
HTTP/200 responses are cacheable by default, unless Expires, Pragma, or Cache-Control headers are present and forbid caching.
...
No Explicit HTTP Expiration information was provided. Most browsers utilize heuristic expiration policies:
10% of the delta between Last-Modified and Date is '3.14:17:30.4000000' so this response will heuristically expire 4/3/2011 5:34:24 AM.
...
Ted