title: Cakephp login / redirect not working in IE10 on Bluehost
body: <p>Convoluted issue but i'll try my best to summarize.</p>
  
  <p>I have a login setup using Cakephp Auth Component, which depending on the role of the user, will redirect the user to the appropriate page. It seems to work fine on Chrome / FF / IE 10 on my local development WAMP setup. But it seems to fail with IE after I've uploaded the site to Bluehost.com.</p>
  
  <p>The problem is <strong>when logging into my website on bluehost via IE10, i keep getting redirected back to the login page after logging in</strong>. The redirect seems to work on any other browser. Strangely it works on IE10 on local dev environement.</p>
  
  <p>USING CAKEPHP 2.4.5</p>
  
  <p><strong>Local dev:</strong> (post login redirect seems to work fine on all browsers)</p>
  
  <p>Wamp 2.4
  Apache 2.4.4
  PHP 5.4.12
  MYSQL 5.6.12</p>
  
  <p><strong>Bluehost:</strong> (post login redirect does not seem to work on IE10, redirects back to login page!)</p>
  
  <p>PHP 5.4
  Apache ???</p>
  
  <p>Here is the cut down version of my AppController showing the Auth declarations.</p>
  
  <pre><code>class AppController extends Controller {
  
      public $components = array(
          'DebugKit.Toolbar',
          'Session',
          'Auth'=&gt;array(
              'loginAction'=&gt;array('controller'=&gt;'users', 'action'=&gt;'login'),
              'logoutRedirect'=&gt;array('controller'=&gt;'users', 'action'=&gt;'loggedout'), 
              'authError'=&gt;'You cannot access that page', //Error message whenever someone access a page without auth
              'authorize'=&gt;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-&gt;name) {
                  case 'Home':
                      return true;
                      break;              
                  case 'BillingCenters':     
                      return true;
                      break;
                  case 'Merchants':     
                      return true;
                      break;
              }
          }
          if($user['role'] == 'merchant') {
              switch ($this-&gt;name) {
                  case 'MCP':
                      return true;
                      break;
                  case 'Users':
                      switch ($this-&gt;action){
                          case 'logout':
                              return true;
                      }
                      return false;
  
              }
          }
  
          die('isAuthorized in AppController denies access to this controller called: ' .  $this-&gt;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-&gt;Auth-&gt;allow('loggedout', 'login');
  
      }
  }
  </code></pre>
  
  <p>Here is the code in my UsersController that pertains to the login. I removed a chunk of SQL database lookup code tat populates the User Role into a session variable to make it more readable. What matters is the end bit that redirects the user based on his role.</p>
  
  <pre><code>public function login() {
  
      $this-&gt;layout = 'loginlogout';
  
  
      if ($this-&gt;request-&gt;is('post')) {
          if ($this-&gt;Auth-&gt;login()) {
  
              /* ---- removed chunk of code that determines Auth.User.role value for Session... for readability, -- */
  
              if ($this-&gt;Session-&gt;read('Auth.User.role') == 'admin') {
                  $this-&gt;redirect(array('controller' =&gt; 'home', 'action' =&gt; 'index'));
  
              }
              if ($this-&gt;Session-&gt;read('Auth.User.role') == 'merchant') {
                  $this-&gt;redirect(array('controller' =&gt; 'MCP', 'action' =&gt; 'snapshot'));
  
              }
              die('Unable to determine user role for redirection');
  
          } else {
              $this-&gt;Session-&gt;setFlash('Your username/password combination was incorrect');
          }
      }
  
  }
  </code></pre>
  
  <p>And below I have attached screenshots of the different browser network traces when after clicking onto the login button. After logging in i am expecting to be redirected to the "MCP/Snapshot". All screenshots are taken when logging into my website on the live server (Bluehost).</p>
  
  <p><strong>CHROME (Login and post login redirect works!)</strong>
  <img src="https://i.stack.imgur.com/9mjoN.jpg" alt="enter image description here"></p>
  
  <p><strong>Firefox  (Login and post login redirect works!)</strong>
  <img src="https://i.stack.imgur.com/C1rut.jpg" alt="enter image description here"></p>
  
  <p><strong>IE10 INTERNET EXPLORER 10 - AFTER LOGGING IN, FAILS TO Load MCP SNAPSHOT PAGE/ACTION and brings user back to Login page again!!</strong>
  <img src="https://i.stack.imgur.com/8yFFx.jpg" alt="enter image description here"></p>
  
  <p>It seems to work when logging into my local development environment (no screenshots provided). Give me a clue someone why this is not working for IE10 on Bluehost? I'm not sure i understand the HTTP return codes 302 either!</p>