I've a Django application with a directory /media/ for all static files. (css, images, js)

I want to speed up the serving of these files with Apache cache control.

How can I setup cache control for ALL that directory?


I've put this in my /etc/apache2/site-available/mysite.com

 <Directory "/srv/www/mysite.com/myproject/media/">
 Options -Indexes
 Header set Cache-Control "max-age=108000, public"

But I get this when I try to load my site with Firefox:

enter image description here

What is in Request Heards Cache-Control: max-age=0 ? It is not wrong?


You could use ExpiresDefault inside <Directory "/path/to/media"> to set cache control to all files within this directory. See mod_expires documentation


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.