我正在尝试在Azure上运行Express应用程序。我想在web.config中使用正则表达式配置一些重定向。但是,当我尝试该网址时。它不会重定向。 Express正在覆盖IIS服务器配置。是否可以通过IIS处理所有重定向来提供静态文件以及nodejs。
我的web.config中的示例代码是
<handlers>
<!-- Indicates that the server.js file is a node.js site to be handled by the iisnode module -->
<add name="iisnode" path="bin/www" verb="*" modules="iisnode" />
</handlers>
<httpRedirect enabled="true" exactDestination="true" httpResponseStatus="Found">
<add wildcard="*ABC" destination="https://example.com/dir1/ABC/" />
</httpRedirect>
<rewrite>
<rules>
<!-- Do not interfere with requests for node-inspector debugging -->
<rule name="NodeInspector" patternSyntax="ECMAScript" stopProcessing="true">
<match url="^bin/www\/debug[\/]?" />
</rule>
<!-- First we consider whether the incoming URL matches a physical file in the /public folder -->
<rule name="StaticContent">
<match url=".*" />
<conditions>
<add input="{StaticRedirects:{PATH_INFO}}" pattern="(.+)" />
</conditions>
<action type="Redirect" url="{C:1}" appendQueryString="true" redirectType="Permanent" />
</rule>
<!-- All other URLs are mapped to the node.js site entry point -->
<rule name="DynamicContent">
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
</conditions>
<action type="Rewrite" url="bin/www" />
</rule>
</rules>
</rewrite>