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

my setup is as follows:

Browser <=> Ec2 Load Balancer <=> Apache (reverse proxy) <=> Jetty

The Apache and the Jetty are running on the same machine in the Amazon cloud (Debian Lenny, Linux appinstance #1 SMP Tue Sep 1 10:25:30 EDT 2009 x86_64 GNU/Linux). The Apache version is 2.2.9. The Jetty version is 6.1.26.

What I'm trying to achieve is basically what Google calls Perfect Caching

My Apache config currently looks like this:

ProxyRequests Off

<Proxy *>
    Order deny,allow
    Allow from all
    SetOutputFilter DEFLATE

ProxyPass /xxx http://localhost:8080/xxx
ProxyPass /yyy http://localhost:8080/yyy
ProxyPass / http://localhost:9080/

ProxyPreserveHost On

<Files *.nocache.*>
    ExpiresActive  On
    ExpiresDefault "access"

<Files *.cache.*>
    ExpiresActive  On
    ExpiresDefault "now plus 1 year"

Currently my ExpiresDefault rules are ignored entirely. I googled for quite a while without any luck.

Is it even possible to combine mod_expires with mod_proxy? If yes: What am I doing wrong? Otherwise: Are there any feasible alternatives?

Cheers! Michael

share|improve this question
up vote 2 down vote accepted

use LocationMatch, not Files. Files refers to actual filesystem files, not what looks like a filename int he last component of a URL.

share|improve this answer
Works like a charm! Thank you very much! This is what my config looks like now: <LocationMatch .*\.nocache\..*> ExpiresActive On ExpiresDefault "access" </LocationMatch> <LocationMatch .*\.cache\..*> ExpiresActive On ExpiresDefault "now plus 1 year" </LocationMatch> – mwuertinger Jul 4 '11 at 8:09

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.