【发布时间】:2015-03-13 16:56:03
【问题描述】:
我从重写模块开始遇到“简单”IIS 8.5 URL 重写重定向 http --> https 对于非 www 站点的问题。
问题:如果域与操作 url 参数匹配,我总是得到“http://”而不是“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。
我想将“http://”重定向到“https://”,但我总是得到“http://”作为响应位置:
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参数:
不工作:
"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/
我找到了“URL Rewrite on IIS from http to https is not working,”,但这并不能解决我的问题。
我错过了什么吗?
【问题讨论】:
标签: redirect iis https url-rewriting rewrite