Wednesday, September 12, 2007

prevent caching of swf,flv or other files

The header fields Cache-Control and Pragma can be used to cache or prevent caching of web content. Using this header fields on html meta tags doesn't seem to work. Forcing them from http server, seems the best way that works with Internet Explorer.

Following example shows how to configure no cache option on Apache web servers
You should add following statements into your httpd.conf file (mod_header should be enabled of course)

Header set Cache-Control "no-cache, must-revalidate"
Header set Pragma no-cache

Another example in php language

header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");


For further details and how to configure IIS server please see this article on Microsoft's site.