Url rewriting IIS Url重写对某些扩展名和字符无效

Url rewriting IIS Url重写对某些扩展名和字符无效,url-rewriting,iis-7.5,Url Rewriting,Iis 7.5,我正在使用IIS 7.5和Url重写模块。这是我的规则 <rule name="stash.domain.com" stopProcessing="true"> <match url="(.*)" /> <action type="Rewrite" url="http://192.168.5.9:8080/{R:1}" logRewrittenUrl="true" /> <conditions> <ad

我正在使用IIS 7.5和Url重写模块。这是我的规则

<rule name="stash.domain.com" stopProcessing="true">
    <match url="(.*)" />
    <action type="Rewrite" url="http://192.168.5.9:8080/{R:1}" logRewrittenUrl="true" />
    <conditions>
        <add input="{HTTP_HOST}" pattern="^stash.domain.com$" />
    </conditions>
</rule>
我从IIS获得以下带有这些URL的响应

404 - File or directory not found.
但是,这些将起作用,但是,代理服务器将返回一个漂亮的“未找到文件”,它告诉我规则已被处理并正确转发请求

http://stash.domain.com/projects/MDX/repos/medxchange.library/browse/Src/MedXChange.Api/CoreServiceUrls

我怀疑IIS有一些顶级过滤功能,可以阻止某些文件扩展名被提供,或者试图绕过重写规则,在IIS内部本地提供这些文件扩展名。另外,我想除了“+”之外,还有更多的字符会导致重写规则被忽略。

我也有这个问题。事实证明,IIS试图提供帮助,并阻止远程用户下载源代码,这正是我试图允许的

修复方法是进入请求过滤并删除所有麻烦条目,尽管我跳过了这一步,只是将其放在web.config中:

<system.webServer>
  <security>
    <requestFiltering>
      <fileExtensions>
        <clear />
      </fileExtensions>
    </requestFiltering>
  </security>
</system.webServer>

如果URL中有任何像&、*或:这样的奇怪字符,您可能还需要设置,因为IIS也会将这些字符过滤为“潜在危险”。
<system.webServer>
  <security>
    <requestFiltering>
      <fileExtensions>
        <clear />
      </fileExtensions>
    </requestFiltering>
  </security>
</system.webServer>