通过代理服务所有请求*除了*特定的

pun*_*ish 14 mod-proxy apache-2.2

我的 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>
Run Code Online (Sandbox Code Playgroud)

这适用于所有对http://foo.org 的请求都使用不同的 Web 服务器从端口 5012 提供服务。但是,我只想通过 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>
Run Code Online (Sandbox Code Playgroud)

Sha*_*den 27

您可以通过mod_proxy使用!一个目的地告诉忽略它来避免代理特定位置:

ProxyPass        /lib !
ProxyPass        / http://127.0.0.1:5012/
ProxyPassReverse / http://127.0.0.1:5012/
Run Code Online (Sandbox Code Playgroud)