问题描述
我在我的服务器中使用 IIS 7.5 作为网络服务器。 请求您支持从 HTTP 到 HTTPS 的 URL 重定向。 我的 HTTP 服务运行在 80 端口,HTTPS 运行在 4545 端口。由于端口更改出现问题。
解决方法
您可以使用此 URL 重写规则:
<rewrite>
<rules>
<rule name="HTTPS Redirect" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="^OFF$" />
</conditions>
<action type="Redirect" url="https://localhost:4545/..." appendQueryString="false" />
</rule>
</rules>
</rewrite>
此规则的URL部分需要自己修改。