【发布时间】:2016-12-14 07:09:16
【问题描述】:
我们正在使用此规则将 HTTP 重定向到 HTTPS:
<rewrite>
<rules>
<rule name="Redirect HTTP to HTTPS" enabled="true" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="^OFF$" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}{HTTP_URL}" redirectType="SeeOther" />
</rule>
</rules>
</rewrite>
这很好用,但是当用户为这样的 URL 添加书签时:
h t t p://www.mysite.com/myapp/login.aspx?ReturlURL=/someurl
它按预期将它们重定向到 HTTPS,但使用 2 ReturnURL 查询字符串,当他们登录时会导致 404 错误:
h t t p s://www.mysite.com/myapp/login.aspx?ReturnURL=/someurl&ReturnURL=/someurl
如何处理这种情况?提前致谢!
【问题讨论】:
-
stackoverflow 不允许使用 URL,所以我必须在 http/https 中添加空格。
标签: asp.net iis url-rewriting