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.

This is a trivialised example highlighting my situation:

ProxyPass /google/ http://www.google.com/
ProxyPassReverse /google/ http://www.google.com/

<VirtualHost 127.0.0.1:82>
   ProxyPass /google/ http://www.yahoo.com/
   ProxyPassReverse /google/ http://www.yahoo.com/
</VirtualHost>

In this case a request "http://127.0.0.1:82/google/" will try to go to http://www.google.com

I have also found that a ProxyPass defined in main will take precedence over actual directories available in a vhost - eg if in above instead of the VirtualHost having ProxyPass rules its DocumentRoot contained a directory named "google" the Proxy would still be in effect.

Per the apache docs, I had been led to believe any "main" definition would be overridden by a VirtualHost able to satisfy the request.

share|improve this question
    
In your example you don't list a ServerName or ServerAlias for the VirtualHost and you're using the loopback address... So are you using 127.0.0.1/google to hit it or using hostname/google where hostname resolves to 127.0.0.1? –  Jeremy Bouse Jul 21 '09 at 1:02
    
I should have specified - the config is IP based virtualhosting so name becomes irrelevant. –  DisabledLeopard Aug 6 '09 at 4:58

1 Answer 1

up vote 2 down vote accepted

Unfortunately, You are right. I don't know if this would be right, but you may remedy it by including the default proxy options to [VirtualHost default] section (http://httpd.apache.org/docs/2.0/vhosts/examples.html#default) like this:

<VirtualHost _default_:80>
        ServerName noneset
        DocumentRoot /dev/null
        ProxyPass /google/ http://www.google.com/
        ProxyPassReverse /google/ http://www.google.com/
<VirtualHost>

<VirtualHost *:80>
        ServerName myhost
        DocumentRoot /var/www
        ProxyPass /google/ http://www.yahoo.com/
        ProxyPassReverse /google/ http://www.yahoo.com/

</VirtualHost>

<Proxy *>
                Order deny,allow
                Allow from all
</Proxy>
share|improve this answer
    
Thanks - seems ProxyPass just isn't over-ridable at all. I've ended up rewriting all my ProxyPass rules as RewriteRule [P] which does the same job but also allows other RewriteRules etc to be processed instead of the ProxyPass being run first & only. –  DisabledLeopard Aug 6 '09 at 5:15

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.