微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

URL重写模块-将HTTP重定向到https到特定端口

如何解决URL重写模块-将HTTP重定向到https到特定端口

我正在使用URL重写将HTTP重定向到HTTPS。 所有步骤都已完成并在工作,包括web.config中的更改。 https://www.sslshopper.com/iis7-redirect-http-to-https.html

<rewrite>
      <rules>
        <rule name="RedirectToHTTPS" stopProcessing="true">
          <match url="(.*)" />
          <conditions>
            <add input="{HTTPS}" pattern="off" ignoreCase="true" />
          </conditions>
          <action type="Redirect" url="https://{SERVER_NAME}/{R:1}" redirectType="Permanent" />
        </rule>       
      </rules>
    </rewrite>

重定向时我面临以下问题。

我想将应用程序重定向到端口90。 我有2个应用程序,一个认端口上,另一个在90端口上。

因此,当有人访问时- http://xxx.xxx.x.xxx:90,然后将其重定向到:- https://xxx.xxx.x.xxx

我希望它重定向https://xxx.xxx.x.xxx:90

有人想过要怎么做吗?

解决方法

将其他任何端口与https一起使用是不安全的。 https的默认端口为443。因此建议使用默认的https端口。

如果您仍要使用HTTP绑定使用其他端口,请确保您的站点绑定正确。

enter image description here

使用以下规则将HTTP重定向到https;

#! /usr/bin/env lua

for n = arg[1],1,-1 do
    local char = ''
    while #char < n do
        if #char %5 == 4 then char = char ..'#'
        else char = char ..'*'
        end  --  mod 5
    end  --  #char
    print( char )
end  --  arg[1]

根据要求使用https和端口90设置重定向URL。

enter image description here

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。