IIS 8.5 URL重写强制重定向http->非www的https [英] IIS 8.5 URL Rewrite force redirect http --> https for non www

查看:190
本文介绍了IIS 8.5 URL重写强制重定向http->非www的https的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从重写模块开始,对非www站点的简单" IIS 8.5 URL重写重定向http-> https有问题.

I am starting with the rewrite module have a problem with a "simple" IIS 8.5 URL Rewrite redirect http --> https for a non www site.

问题:如果域与action url参数匹配,我总是得到"http://"而不是"https://".

Problem: If the domain matches the action url parameter i always get "http://" and not "https://".

这是我的规则:

<rewrite>
  <rules>
    <rule name="Redirect to HTTPS" stopProcessing="true">
      <match url="(.*)" />
      <conditions>
        <add input="{HTTPS}" pattern="^OFF$" />
      </conditions>
      <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Permanent" />
    </rule>
  </rules>
</rewrite>

我无法发布多个链接,因此域" = crm.test.com.具有重写规则的站点在端口2080上绑定到"domain" = crm.test.com.

I can't post several links so "domain" = crm.test.com. The site with the rewrite rule is bound to "domain"=crm.test.com on port 2080.

我想将"http://"重定向到"http s ://",但在响应中,我总是以"http://"作为位置:

I want to redirect "http://" to "https://", but i always get "http://" as location in response:

   HTTP/1.1·302·Redirect
   Connection:·close
   Content-Length:·176
   Date:·Thu,·15·Jan·2015·08:21:21·GMT
   Location:·http://domain/                      <--
   Content-Type:·text/html;·charset=UTF-8
   Server:·Microsoft-IIS/8.5
   X-Powered-By:·ASP.NET

我尝试了以下操作url参数:

I tried the following action url parameter:

不起作用:

"https://{HTTP_HOST}/{R:1}" -> http://domain/
"https://domain/{R:1}" -> http://domain/
"https://{HTTP_HOST}:443/{R:1}" -> http://domain/
"https://{HTTP_HOST}/1" -> http://domain/1/

工作:

"https1://{HTTP_HOST}/{R:1}" -> https1://domain/
"https://{HTTP_HOST}:444/{R:1}" -> https://domain:444/
"https://test.domain.com/{R:1}" -> https://test.domain.com/
"https://www.google.com/{R:1}" -> https://www.google.com/

我发现"

I found "URL Rewrite on IIS from http to https is not working,", but this doesn't solve my problem.

我错过了什么吗?

推荐答案

O. k.,我找到了解决方案-链接翻译是由iis前面的tmg 2010引起的. tmg有一个错误,如果是301,则链接转换会将https链接重置为http.此处描述了一个解决方案的问题:

O. k., i found the solution - the link translation is caused by a tmg 2010 in front of the iis. The tmg has a bug where the link translation resets the https links to http in case of a 301. Problem an solution are described here:

http://blog.sanibellogic.com/2008/09/default

http://support.microsoft.com/kb/924373

谢谢大家.

这篇关于IIS 8.5 URL重写强制重定向http-&gt;非www的https的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆