如何使用 ProxyMatch 或 ProxyPassMatch 和 Regex 来映射多个上下文路径

use*_*950 2 regex apache contextpath

我正在使用IBM 的 IHS Webserver,它构建在 Apache Web 服务器版本 2.2.4 之上。

我的要求是在匹配中使用正则表达式代理传递各种上下文路径。

我尝试使用,ProxyPassMatch但出现以下错误

错误:“无效的 ProxyPass|ProxyPassMatch 参数。参数必须采用‘key=value’形式”

<LocationMatch "^/(ae/en|ar/en|ar/es|at/en|au/en|be/en|br/en)/">
Order Allow,Deny
Allow from all
ProxyPass http://www.xyz.com.au:80/au/en/      #(should keep varying as per the regex matched in location match )
ProxyReverse http://www.xyz.com.au:80/au/en/   #(should keep varying as per the regex matched in location match )
</LocationMatch>
Run Code Online (Sandbox Code Playgroud)

请建议如何实现这一点。

问候斯里达尔

MKa*_*ama 7

如果您将ProxyPassMatch放在LocationMatch部分旁边,则必须省略ProxyPassMatch (regex) 的第一个参数。它将来自 LocationMatch。我的(工作)配置示例:

<VirtualHost *:80>
ServerName gopal.lv
ServerAlias gopal.lv www.gopal.lv
ProxyPreserveHost On

<LocationMatch "^/(img|js|css|att|thumb|banner)/(.+)$">
#Note: only 1 argument here
ProxyPassMatch "http://192.168.1.11/$1/$2"
</LocationMatch>

#Note we have 2 arguments here
ProxyPassMatch "^/(img|js|css|att|thumb|banner)/(.+)$" "http://192.168.1.11/$1/$2"
ProxyPass / http://192.168.1.12/

</VirtualHost>
Run Code Online (Sandbox Code Playgroud)

否则,你会得到错误

错误:“无效的 ProxyPass|ProxyPassMatch 参数。参数必须采用‘key=value’形式”

它记录在这里:https : //httpd.apache.org/docs/trunk/mod/mod_proxy.html#proxypass