我正在尝试使用IIS 7.5,0.3.0(ARR)和URL Rewrite 2.0为Jenkins设置反向代理。包含百分号(%)的IIS反向代理重新编码URL
我有代理主要工作,但我遇到的问题与包含百分号(%)的网址。
无论我尝试什么,代理都会坚持对重写的URL中的百分号进行解码或重新编码。
这就是我想要的URL重写:
http://my.proxy/a%2Fb -> http://my.host:8080/a%2Fb
这是网址如何实际上被改写:
http://my.proxy/a%2Fb -> http://my.host:8080/a/b
- or -
http://my.proxy/a%2Fb -> http://my.host:8080/a%252Fb
我怎样才能获得IIS \ ARR \重写停止重新编码我重写的URL?
事情我已经尝试:
一个正常的反向代理(重写URL作为
http://my.host:8080/a/b
):<rule name="ReverseProxyInboundRule1" stopProcessing="true"> <match url="(.*)" ignoreCase="true" /> <action type="Rewrite" url="http://my.host:8080/{R:1}" /> </rule>
使用
UNENCODED_URL
服务器变量(重写URL为http://my.host:8080/a%252Fb
):<rule name="ReverseProxyInboundRule1" stopProcessing="true"> <match url="(.*)" ignoreCase="false" /> <conditions logicalGrouping="MatchAll"> <add input="{UNENCODED_URL}" pattern="/(.*)" /> </conditions> <action type="Rewrite" url="http://my.host:8080/{C:1}" /> </rule>
就在直输入URL(作为测试 - 也重写URL作为
http://my.host:8080/a%252Fb
):在<rule name="ReverseProxyInboundRule1" stopProcessing="true"> <match url="(.*)" ignoreCase="false" /> <action type="Rewrite" url="http://my.host:8080/a%2Fb" /> </rule>
所有的想法斯科特Hanselman的优秀 “Experiments in Wackiness: Allowing percents, angle-brackets, and other naughty things in the ASP.NET/IIS Request URL”
<httpRuntime requestValidationMode="2.0" requestPathInvalidCharacters="*,:,&,\" relaxedUrlToFileSystemMapping="true" />
<security> <requestFiltering allowDoubleEscaping="true" /> </security>'
注:我就遇到了这个问题,当我的IIS反向代理相抵触的Jenkins' built-in reverse proxy checking system它试图做一个HTTP重定向到这种形式的URL跑去。
你有没有想出解决办法?我现在有同样的问题... – Korijn
不幸的是,没有。出于这个原因,我已经不再考虑将IIS作为可接受的反向代理平台。 –
你用什么来代替? – Martin