Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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/

 <Directory "/srv/www/">
 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?

share|improve this question
up vote 2 down vote accepted

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

share|improve this answer
check my update please. – Fred Collins May 13 '11 at 19:35
Request Headers is what your Firefox has sent to server. Quick googling says that Firefox does so when user hits Reload button. – AlexD May 14 '11 at 9:00
Ok guy. Thank you. – Fred Collins May 14 '11 at 19:21

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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