使用查询参数将字符串附加到ProxyPass或ProxyPassMatch规则

时间:2017-04-11 10:55:31

标签: mod-rewrite proxy reverse-proxy mod-proxy proxypass

我目前有以下网址:/my-url/?foo=bar 然后使用以下代理规则:

ProxyPass /my-url/ http://mynewlocation.com/my-url/
ProxyPassReverse /my-url/ http://mynewlocation.com/my-url/

所以我最终得到http://mynewlocation.com/my-url/?foo=bar

我想在我回来的网址末​​尾添加一个新的字符串/ param,因此包含了原始的url查询参数,并添加了我的新字符串。

举个例子让我想说 /my-url/?foo=bar成为http://mynewlocation.com/my-url/?foo=bar&test=true

我将如何做到这一点?

我尝试将其更改为ProxyPassMatch,如下所示:

ProxyPassMatch ^/my-url/(.*) http://mynewlocation.com/my-url/$1&test=true
ProxyPassMatchReverse ^/my-url/(.*) http://mynewlocation.com/my-url/$1&test=true

导致http://mynewlocation.com/my-url/test=true因此它只是删除查询字符串,任何人都知道我做错了什么?

感谢

0 个答案:

没有答案