Geoff Hardy
Geoff Hardy

Reputation: 57

FLV files caching. Set header

I have flv files on my server which have changing content but not necessarily changing names.

I am having an issue whereby the flv files send headers which set the file to cache. As sometimes the same user may require the same file with different content later the files need to tell the browser not to cache them.

I have tried using something similar to PHP's header() command but when I run:

Curl -I myfile.com/file1.flv 

The headers are still there.

Any help please?

Upvotes: 1

Views: 320

Answers (1)

Craig Taub
Craig Taub

Reputation: 4179

I am not sure how you tried using PHP for this, it is apache which is processing and dispatching the file so best to start there.

Try the below:

1) Enable headers.load (headers module) on apache. Else wont work.

2) add below to .htaccess. This will capture file types of all the below formats and set them not to cache.

<FilesMatch "\.(jpg|gif|js|css|ico|swf|zip|pdf|doc|htc|xls|rtf|odt|wav|mp3|avi|wmv|mov|txt|flv)$"> FileETag None
<IfModule mod_headers.c>
Header unset ETag
Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate" Header set Pragma "no-cache"
Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT"
</IfModule>
</FilesMatch>

3) restart apache.

4) Try 'curl -i www.url.com/file.flv' command again.

You should see the headers tell the file to not cache.

Upvotes: 3

Related Questions