Ankit Prasad
Ankit Prasad

Reputation: 71

leveraging browser caching for images served through CDN

I have written this in my .htaccess file to leverage browser caching:

# 480 weeks caching
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
Header set Cache-Control "max-age=290304000, public"
</FilesMatch>

It is working well for files coming from mydomain.com url but the problem is that it does not affect the images coming from CDN URLs which are actually subdomains static.mydomain.com etc.

How can I leverage browser caching for images served through CDN?

Upvotes: 1

Views: 1125

Answers (1)

user2422457
user2422457

Reputation:

Are you using S3? You can add this header in the S3 console for resources you want to cache:

CacheControl: max-age=999999

Upvotes: 3

Related Questions