Special note for Apache Webmasters

The header functionality only works if you have enabled the header mod. Refer to your local documentation for more information on how to do this.

For example, the <Location> directive below would add the line Cache-Control: max-age=604800 to every image that comes out of www.mysite.com/AGChannel/images/:

<Location /AGChannel/images/> Header append 
Cache-Control "max-age=604800" </Location>

Likewise, the <Location> directive below would add Cache-Control: max-age=43200 to every Web page that is located in www.mysite.com/AGChannel/articles :

<Location /AGChannel/articles/> Header append 
Cache-Control "max-age=43200" </Location>

What if there is one Web page in the /AGChannel/articles/ directory that should have a shorter cache time? If you follow the previous directive with the <Location> directive below, it won't work:

<Location /AGChannel/articles/hourlynews.html> Header append 
Cache-Control "max-age=3600" </Location>

The <Location> directive above produces the Cache-Control header below:

Cache-Control: max-age=43200, max-age=3600

This is pretty confusing and error-prone, and it is hard to predict which age the proxy server will actually obey. Instead, try something like this:

<Location /AGChannel/articles/> Header append 
Cache-Control "max-age=43200" </Location>
<Location /AGChannel/articles/hourlynews.html> 
Header unset Cache-Control 
Header append Cache-Control "max-age=3600" </Location>

The Header unset Cache-Control directive will remove any and all Cache-Control headers, so that you have a clean slate on which to add your own.