我们有一个主要地址example1.example.com,我们为此地址发出了Https证书。但主要代码是在example2.example.com上,我们用来将第一个重定向到这个。 现在我们想要使用https,我想知道我们是否可以这样做。我们在第二台服务器上没有任何https证书。
答案 0 :(得分:1)
答案 1 :(得分:0)
在Global.asax中我有这个块:
if (Request.ServerVariables["HTTPS"] != "on")
{
Response.Redirect(Request.Url.AbsoluteUri.Replace("http://", "https://"), true);
return;
}
这会将http请求转换为https,如果example2返回example1,则需要在example1上执行此操作。
对于你想做的事情,这应该有效:
if (Request.ServerVariables["HTTPS"] == "on")
{
Response.Redirect(Request.Url.AbsoluteUri.Replace("https://", "http://"), true);
return;
}