Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm using Apache as a load balancer for application requests, but I would like it to serve static requests itself. At the moment, everything is getting passed through to the back-end servers. I'm sure that this is something simple, but I can't get the incantation right. My current configuration looks like:

Alias /static "C:/path/to/my/static/files"
<Location "/static">
  SetHandler None
  Options Indexes
  Order allow,deny
  Allow from all    
</Location>

<Proxy balancer://mycluster>
    BalancerMember http://foo:9000 route=0
    BalancerMember http://bar:9001 route=1
    BalancerMember http://baz:9002 route=2
</Proxy>

<Location />
    Order Allow,Deny
    Allow from all
    ProxyPass balancer://mycluster/
</Location>
share|improve this question
    
After reading the Apache docs more carefully, several times, I realize that the "Location /static" bit should be "Directory static", and that the "Location /" bit is overriding ALL the other settings anyway. I'm trying to get something like LocationMatch "(?<!\.css|\.png>)$" working, but now EVERYTHING is getting sent locally. –  Chris Curvey Feb 25 '11 at 18:04
add comment

1 Answer

up vote 1 down vote accepted

You might need to re-work the configuration a bit but adding an exclamation point at the end of a proxypass statement is supposed to prevent proxying of that subdirectory. For example, something like:

ProxyPass /static !
ProxyPass / balancer://mycluster/
share|improve this answer
    
that did it! Just had to pull out the <Location /> block and it worked like a charm! –  Chris Curvey Mar 8 '11 at 2:14
add comment

Your Answer

 
discard

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.