多个 Url 重写规则 - 最后得到 403
Multiple Url rewrite rules - got 403 on the last
我有以下规则,但是当我访问 https://myserver/myapp/sparoute/1 时,我得到的是 403 而不是 index.html
我在 myapp 的根目录下得到了这个配置:
<system.webServer>
<rewrite>
<rules>
<rule name="Reverse Proxy to API" stopProcessing="true">
<match url="api/(.*)" />
<conditions>
<add input="{CACHE_URL}" pattern="^(https?)://" />
</conditions>
<action type="Rewrite" url="https://internalserver/myapp/{R:0}" />
</rule>
<rule name="Reverse Proxy to Signalr" stopProcessing="true">
<match url="messagehub(.*)" />
<conditions>
<add input="{CACHE_URL}" pattern="^(https?)://" />
</conditions>
<action type="Rewrite" url="https://internalserver/myapp/{R:0}" />
</rule>
<rule name="Handle History Mode for SPA (myapp)" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="/" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
前两个规则有效,但在重写为 / 时没有返回默认值 index.html,我得到了 403。有什么想法吗?
重写url与网站相关。所以最后一个动作应该是
<action type="Rewrite" url="/myapp" />
我有以下规则,但是当我访问 https://myserver/myapp/sparoute/1 时,我得到的是 403 而不是 index.html
我在 myapp 的根目录下得到了这个配置:
<system.webServer>
<rewrite>
<rules>
<rule name="Reverse Proxy to API" stopProcessing="true">
<match url="api/(.*)" />
<conditions>
<add input="{CACHE_URL}" pattern="^(https?)://" />
</conditions>
<action type="Rewrite" url="https://internalserver/myapp/{R:0}" />
</rule>
<rule name="Reverse Proxy to Signalr" stopProcessing="true">
<match url="messagehub(.*)" />
<conditions>
<add input="{CACHE_URL}" pattern="^(https?)://" />
</conditions>
<action type="Rewrite" url="https://internalserver/myapp/{R:0}" />
</rule>
<rule name="Handle History Mode for SPA (myapp)" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="/" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
前两个规则有效,但在重写为 / 时没有返回默认值 index.html,我得到了 403。有什么想法吗?
重写url与网站相关。所以最后一个动作应该是
<action type="Rewrite" url="/myapp" />