首页 > 解决方案 > Apache ProxyPassMatch 匹配路径,包括顶级域

问题描述

我有两个域

  1. api.myorg.host
  2. api.myorg.com

如何根据顶级域及其路径进行匹配。我试过跟随,但不起作用。

config1.conf

ProxyPassMatch ".host/v2/test(.*)" "https://api.myorg-one.com/v2/test$1" nocanon
ProxyPassReverse ".host/v2/test(.*)" "https://api.myorg-one.com/v2/test$1" nocanon
<LocationMatch ".host/v2/test(.*)">
        Order allow,deny
  Allow from all
</LocationMatch>

config2.conf

ProxyPassMatch ".com/v2/test(.*)" "https://api.myorg-two.com/v2/test$1" nocanon
ProxyPassReverse ".com/v2/test(.*)" "https://api.myorg-two.com/v2/test$1" nocanon
<LocationMatch ".com/v2/test(.*)">
        Order allow,deny
  Allow from all
</LocationMatch>

标签: regexapachehttpreverse-proxy

解决方案


推荐阅读