通过代理服务所有请求*特定对象除外


11

我的httpd.conf中包含以下内容

<VirtualHost *:80>
    ServerName foo.org
    ServerAlias www.foo.org

    <Proxy *>
        Options FollowSymLinks MultiViews
        Order allow,deny
        Allow from all
        AllowOverride All
    </Proxy>

    ProxyPass        / http://127.0.0.1:5012/
    ProxyPassReverse / http://127.0.0.1:5012/
</VirtualHost>

当使用不同的Web服务器从端口5012获得对http://foo.org的所有请求时,此方法效果很好。但是,我只想通过Apache从端口80 提供http://foo.org/lib。我该怎么做?将以下行添加到conf中无济于事

Alias /lib /path/to/lib

<Directory "/path/to/lib">
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all
</Directory>

Answers:


18

您可以通过使用目的地来告知mod_proxy忽略某个特定位置,从而避免代理该特定位置!

ProxyPass        /lib !
ProxyPass        / http://127.0.0.1:5012/
ProxyPassReverse / http://127.0.0.1:5012/

太棒了!就这么简单!我尝试了NoProxy,但ProxyMatch with various regexps没有成功。谢谢。
庞克音乐
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.