[ale] apache2 config Q - FilesMatch weirdness

Chris Woodfield rekoil at semihuman.com
Fri Sep 19 12:35:11 EDT 2008


Hi,

I'm trying to set Cache-Control headers for my installation of  
gallery2. By default, it generates Expires: headers, but not Cache- 
Control: headers, which is bad due to a weird interaction with a squid  
reverse proxy I'm putting in front of it.

So here's a URL that I want to add a cache-control: header to:

http://www.semihuman.com/gallery/main.php/d/492-4/10thAnniv_1.jpg

And here's what I added to the relevant apache2 site config file:

       <IfModule mod_headers.c>
          <FilesMatch "\.(gif|jpg|jpeg|png)$">
             Header set Cache-control "max-age=3600, stale-if- 
error=3600"
          </FilesMatch>
          <FilesMatch "\.php$">
             Header set Cache-control "max-age=90, stale-if-error=3600"
          </FilesMatch>
       </IfModule>

However, when I fetch that URL, I see the following header:

Cache-control: max-age=90, stale-if-error=3600

So for some reason, the first FilesMatch rule is being missed, but the  
second one is being matched on, which doesn't make sense to me (the $  
is there to only match urls that END in .php, right?)

I know I'm missing something fundamental here. Anyone care to educate  
me?

Thanks,

-Chris


More information about the Ale mailing list