我希望将多个面向客户的URLMap到单个内部终结点,但使用查询参数来标识每个客户。
例如,客户输入https://external_host/customer1
我希望反向代理将其作为https://internal_host/app?customer=cust1转发
我已尝试以下方法:
<Location "/customer1" >
RewriteEngine On
RewriteRule /customer1 /customer1?customer=cust1 [QSA,P]
ProxyPass https://<internal host>/app
ProxyPassreverse https://<internal host>/app
</Location>
<Location "/customer2" >
RewriteEngine On
RewriteRule /customer2 /customer2?customer=cust2 [QSA,P]
ProxyPass https://<internal host>/app
ProxyPassreverse https://<internal host>/app
</Location>
基本代理工作正常,因为请求被转发到内部服务器,但不添加查询参数。
从我所做的所有阅读来看,我觉得应该有可能做我想做的事情,但不能让它发挥作用。
感谢您的指点。
祝你好运,Chris
2条答案
按热度按时间chhqkbe11#
我解决这个问题的方法如下:
克里斯
of1yzvn42#
问题配置中的
ProxyPass
和ProxyPassReverse
被忽略,因为[QSA,P]
中的P
执行代理请求。将查询参数
extraparam=something
添加到代理服务器的一些其他情况:正则表达式***和***远程服务器
如果需要在规则中使用正则表达式(第一个通配符
(.*)
替换为$1
):如果代理服务器使用***https***,则应将
SSLProxyEngine On
添加到配置中: