2014-12-01 122 views
0

我在codeigniter框架中使用cloudflare,並且在操作完成時嘗試將腳本重定向到另一個頁面時遇到奇怪的問題,服務器使用拋出錯誤520(cloudflare server)重定向在php中拋出520錯誤CloudFlare

$input = $this->input->post(); 

if(!empty($input)){ 

     $this->load->library('form_validation'); 

     $this->form_validation->set_rules('email', 'Email', 'required|email'); 
     $this->form_validation->set_rules('password', 'Password', 'required'); 

     if ($this->form_validation->run() == TRUE) 
     { 
      $r = $this->userModel->login($input["email"], $input["password"]); 
      if($r["success"] == "t"){ 

       $this->userModel->setSession($r["_user_id"], $r["token"]); 

       //Both redirect methods does not works 
       //echo '<html><head><META http-equiv="refresh" content="0;URL='.$this->glob->exec_redirect().'"></head><body></body></html>'; 
       redirect($this->glob->exec_redirect()); 
       die(); 
      }else{ 
       $data["errors"] = $r["message"]; 
      } 
     }else 
      $data["errors"] = validation_errors(); 
    } 
    $this->load->view("user/login", $data); 

此腳本工作正常,沒有cloudflare,也沒有重定向功能的腳本工作良好的cloudflare。 演示:

Sample which throws error

用戶:測試

:TEST12

有時候你應該嘗試更多的再一次崩潰

Sample without redirect

工作正常,用戶登錄只需重定向曼努埃爾。

問候。

+1

嘗試刪除'die()'? – w00d 2014-12-01 16:52:46

+0

我做到了,它沒有工作 – 2014-12-01 17:05:28

回答

1

我登錄了,它工作。然後,我註銷並嘗試再次登錄,我看到您正在談論的520錯誤。

我認爲這與您的重定向網址有關。

https://www.plac24.com/user/login?rdr=http%3A%2F%2Fwww.plac24.com%2F 

當您將它們重定向到您的網站時,是否需要http://?

+0

有幾個頁面正在使用https這樣的登錄,註冊...,他們被迫在https旁邊別人強制HTTP! – 2014-12-01 16:48:08

+0

問題似乎是表單動作,它只是#這意味着相同的網址:'https://www.plac24.com/user/login?rdr = http%3A%2F%2Fwww.plac24.com%2F'我將它替換爲'https:// www.plac24.com/user/login',現在它工作正常:) – 2014-12-02 10:02:37

0

你是否在做任何發送大型cookie或頭文件的事情?這可能是因爲&支持可以幫助排除故障。

+0

$ this-> userModel-> setSession()方法保存所有必要的會話! – 2014-12-01 21:34:08