IIS将端口8880上的http重定向到端口8443上的https

时间:2017-09-01 12:09:52

标签: iis url-rewriting url-rewrite-module

我宁愿在这里挣扎。我已经看到了80到443的很多答案,但是我的控制面板确实很难用8880到8443。

需要重定向的网址示例:http://udweb01.servers.unreal-designs.co.uk:8880/admin/home?context=home

应该导致:https://udweb01.servers.unreal-designs.co.uk:8443/admin/home?context=home

注意http - > https和8880 - > 8443。

我们现有的规则是:

<rule name="Force SSL (8443)" enabled="true" stopProcessing="true">
  <match url="^(http://)?(.*):8880(/.*)?$" />
  <action type="Redirect" url="https://{R:2}:8443{R:3}" appendQueryString="true" redirectType="Found" />
</rule>

但这似乎没有做任何事情。有什么想法吗?

1 个答案:

答案 0 :(得分:1)

你的规则应该是这样的:

<rule name="Redirect with port" stopProcessing="true">
     <match url=".*" />
     <conditions>
          <add input="{HTTP_HOST}" pattern="^(.*):8880$" />
     </conditions>
     <action type="Redirect" url="https://{C:1}:8443/{R:0}" />
</rule>

在此规则中,您的条件<add input="{HTTP_HOST}" pattern="^(.*):8880$" />将只接受端口为8880的http主机

相关问题