功能不是IIS

功能不是IIS

问题描述:

工作我使用这个功能来重定向到投资组合后,用户登录...功能不是IIS

function redirect($destination) 
{ 

    //handle url 
    if (preg_match("/^https?:\/\//", $destination)) 
    { 
     header("Location: " . $destination); 
    } 

    // handle absolute path 
    else if (preg_match("/^\//", $destination)) 
    { 
     $protocol = (isset($_SERVER["HTTPS"])) ? "https" : "http"; 
     $host = $_SERVER["HTTP_HOST"]; 
     header("Location: $protocol://$host$destination"); 
    } 

    // handle relative path 
    else 
    { 
     // adapted from http://www.php.net/header 
     $protocol = (isset($_SERVER["HTTPS"])) ? "https" : "http"; 
     $host = $_SERVER["HTTP_HOST"]; 
     $path = rtrim(dirname($_SERVER["PHP_SELF"]), "/\\"); 
     header("Location: $protocol://$host$path/$destination"); 
    } 

    // exit immediately since we're redirecting anyway 
    exit; 
} 

使用它产生的SSL连接错误中铬: 错误107(净值:: ERR_SSL_PROTOCOL_ERROR) :SSL协议错误。 in firefox 连接到本地主机时发生错误:63077。

SSL received a record that exceeded the maximum permissible length. 

(错误代码:SSL_ERROR_RX_RECORD_TOO_LONG

请不要告诉我的问题...... 告诉我的解决方案或替代 我有一个Windows Azure的帐户... 它甚至不工作有.... 亲切的问候 维沙尔

PS:我知道这是要花费大量的时间.... 我真的需要为我的想象杯亲ject ..

+0

http://*.com/a/2522413/215042您甚至在IIS中启用SSL和/或安装证书吗?为什么你重定向到63077而不是443? – RobIII 2013-03-27 17:39:20

+0

@Robll它也不适用于Windows Azure ... – 2013-03-27 17:54:43

+1

我的评论适用于IIS,Azure,Apache,无论您使用什么。在每种情况下,您都需要配置SSL /安装证书等。并且可能使用端口63077也无法帮助解决此问题... – RobIII 2013-03-27 18:16:49

似乎你有问题得到正确的协议。我不知道这是否会在IIS上工作,但我一般用在Linux下面的 - 无法想象,为什么它不会工作:

function getProtocol() 
{ 
     return $_SERVER['SERVER_PORT']=='443'?'https://':'http://'; 
} 

这应该去除大部分的复杂性在你的代码?