Apache mod_proxy proxyPass匹配顺序

Ras*_*ard 5 apache mod-proxy

如果我有两个代理规则,并且它们“重叠”,有没有办法指定最重要的规则?

示例(虚拟主机定义的一部分。)

ProxyPass /foo http://bar:8180/
ProxyPass / http://bar:8181/
Run Code Online (Sandbox Code Playgroud)

这里所有流量都会被代理到http://bar:8181/,因为它首先匹配url。

有没有办法/foo/index.htmlhttp://bar:8180(代理通行证匹配上的顺序或类似)?

pow*_*ete 4

mod_proxy/2.4的文档说:

配置的ProxyPass和ProxyPassMatch规则按照配置的顺序进行检查。第一个匹配的规则获胜。

因此,也许您的第一条规则由于缺少尾部斜杠(在 foo 之后)而不会匹配:

ProxyPass /foo/ http://bar:8180/
Run Code Online (Sandbox Code Playgroud)