Internet explorer Bluehost上的Cakephp登录/重定向在IE10中不起作用

Internet explorer Bluehost上的Cakephp登录/重定向在IE10中不起作用,internet-explorer,cakephp,redirect,wamp,bluehost,Internet Explorer,Cakephp,Redirect,Wamp,Bluehost,这个问题很复杂,但我会尽力总结 我有一个使用Cakephp Auth组件的登录设置,它根据用户的角色将用户重定向到适当的页面。在我的本地开发WAMP设置中,它似乎在Chrome/FF/IE10上运行良好。但在我把网站上传到Bluehost.com之后,IE似乎失败了 问题是,当我通过IE10在bluehost上登录我的网站时,我在登录后不断被重定向回登录页面。重定向似乎适用于任何其他浏览器。奇怪的是,它在本地开发环境的IE10上工作 使用CakePHP2.4.5 本地开发人员:(登录后重定向似乎

这个问题很复杂,但我会尽力总结

我有一个使用Cakephp Auth组件的登录设置,它根据用户的角色将用户重定向到适当的页面。在我的本地开发WAMP设置中,它似乎在Chrome/FF/IE10上运行良好。但在我把网站上传到Bluehost.com之后,IE似乎失败了

问题是,当我通过IE10在bluehost上登录我的网站时,我在登录后不断被重定向回登录页面。重定向似乎适用于任何其他浏览器。奇怪的是,它在本地开发环境的IE10上工作

使用CakePHP2.4.5

本地开发人员:(登录后重定向似乎在所有浏览器上都能正常工作)

Wamp 2.4 Apache 2.4.4 PHP 5.4.12 MYSQL 5.6.12

Bluehost:(登录后重定向在IE10上似乎不起作用,重定向回登录页面!)

PHP5.4 阿帕奇

下面是我的AppController的精简版本,显示了身份验证声明

class AppController extends Controller {

    public $components = array(
        'DebugKit.Toolbar',
        'Session',
        'Auth'=>array(
            'loginAction'=>array('controller'=>'users', 'action'=>'login'),
            'logoutRedirect'=>array('controller'=>'users', 'action'=>'loggedout'), 
            'authError'=>'You cannot access that page', //Error message whenever someone access a page without auth
            'authorize'=>array('Controller') //Where in our application that authorization will occur
        )
    );

    ////Determines what logged in users have access to
    public function isAuthorized($user) {

        if($user['role'] == 'admin') {
            switch ($this->name) {
                case 'Home':
                    return true;
                    break;              
                case 'BillingCenters':     
                    return true;
                    break;
                case 'Merchants':     
                    return true;
                    break;
            }
        }
        if($user['role'] == 'merchant') {
            switch ($this->name) {
                case 'MCP':
                    return true;
                    break;
                case 'Users':
                    switch ($this->action){
                        case 'logout':
                            return true;
                    }
                    return false;

            }
        }

        die('isAuthorized in AppController denies access to this controller called: ' .  $this->name);
    }

    //Determines what non logged in users have access to
    public function beforeFilter() {
        //Logic placed here will run before the action is run
        parent::beforeFilter();
        $this->Auth->allow('loggedout', 'login');

    }
}
以下是我的UsersController中与登录相关的代码。我删除了一段SQL数据库查找代码tat将用户角色填充到会话变量中,以使其更具可读性。重要的是根据用户的角色重定向用户的结束位

public function login() {

    $this->layout = 'loginlogout';


    if ($this->request->is('post')) {
        if ($this->Auth->login()) {

            /* ---- removed chunk of code that determines Auth.User.role value for Session... for readability, -- */

            if ($this->Session->read('Auth.User.role') == 'admin') {
                $this->redirect(array('controller' => 'home', 'action' => 'index'));

            }
            if ($this->Session->read('Auth.User.role') == 'merchant') {
                $this->redirect(array('controller' => 'MCP', 'action' => 'snapshot'));

            }
            die('Unable to determine user role for redirection');

        } else {
            $this->Session->setFlash('Your username/password combination was incorrect');
        }
    }

}
下面我附上了点击登录按钮后不同浏览器网络跟踪的截图。登录后,我希望被重定向到“MCP/快照”。所有截图都是在live server(Bluehost)上登录我的网站时拍摄的

CHROME(登录和登录后重定向有效!)

Firefox(登录和登录后重定向有效!)

IE10 INTERNET EXPLORER 10-登录后,无法加载MCP快照页面/操作,并再次将用户带回登录页面


当登录到我的本地开发环境(没有提供屏幕截图)时,它似乎可以工作。给我一个线索,为什么这不适用于Bluehost上的IE10?我也不确定我是否理解HTTP返回码302

通过一些测试,我逐渐意识到,每次我更改页面时,Internet Explorer/IE似乎都会丢失我的会话信息,无论是作为url栏的手动url输入,还是由Cakephp的重定向命令触发的重定向

我发现,在webroot/index.php中添加session_start()的解决方案神秘地帮助解决了这个问题。我不知道如何解释它,我希望它不会产生额外的bug,因为我不完全理解插入这行代码对cakephp的影响

我发现,在core.php中调整用户代理和安全级别的值的其他解决方案似乎没有真正的帮助,尽管它们的问题和症状与我的类似