Forum Moderators: phranque

Message Too Old, No Replies

.htaccess Cache Control

I just can't get it to work!

         

inveni0

7:45 pm on Sep 5, 2007 (gmt 0)

10+ Year Member



Here are the contents of my .htaccess file:

ExpiresActive On

<FilesMatch "\.(swf)$">
Header set Cache-Control "max-age=5, private, proxy-revalidate"
</FilesMatch>

But this does not prevent caching! I can load a file, like www.mysite.com/123.swf, wait 10-15 second and then enter the url www.mysite.com/123.swf into my browser and it doesn't fetch a new copy. What's the deal?

jdMorgan

8:13 pm on Sep 5, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The "private" attribute explicitly allows the file to be cached in a private cache, e.g. your browser.

Additionally, if you want to force the client to check with the server to see if the file has been modified, use "must-revalidate".

Be careful of the Cache-control header attributes; Because of widespread mistakes made in early server and proxy implementations, these attributes don't always mean exactly what they say. For example, "no-cache" doesn't really mean "don't cache this at all" unless you add "must-revalidate".

Jim

[edited by: jdMorgan at 8:14 pm (utc) on Sep. 5, 2007]