简体   繁体   English

IIS重写规则不匹配-设置反向代理

[英]IIS rewrite rule not matching — setting up reverse proxy

This seems to be like the simplest of thing which I am unable to resolve. 这似乎是我无法解决的最简单的事情。

I want to rewrite URL if it contains the string extFlow , to a different host. 我想将包含字符串extFlow的 URL重写到其他主机。

http://site1/extFlow/Testsvc/GetData/?val=1

to

http://site2/extFlow/Testsvc/GetData/?val=1

I have tried all rules eg: 我尝试了所有规则,例如:

  <rules>
    <rule name="Reverse Proxy to external" stopProcessing="true">
      <match url="extFlow/(.*)" />
      <action type="Rewrite" url="http://site2/{R:1}" />
    </rule>
  </rules>

If I just match with (.*) then the rewrite happens. 如果我只与(。*)匹配,则会发生重写。

I am not able to match even with * match url="extFlow" 即使使用* match url =“ extFlow”,我也无法匹配

What am I missing? 我想念什么?

Based on your statement "Yes for testing purpose I have both sites on same machine, but on a different port", I think that's what is breaking your rule. 根据您的陈述“是的,为了测试目的,我将两个站点都放在同一台机器上,但是在不同的端口上”,我认为这是违反您的规则的原因。 Let me disintegrate and explain it. 让我分解并解释它。

Let me know if you have any questions. 如果您有任何疑问,请告诉我。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM