1

I am working on CAKE PHP 2.5.x and if user session expired then I throw 401 unauthorized exception in response to HTTP/AJAX request.

Now, if I logged out meanwhile and browser sends AJAX request to server. So in such case server sends 401 exception.

$( document ).ajaxError(function(x,e){
    if(e.status == "401"){
        alert('requested restricted area!');
        window.location.reload();
    }
});

From above code, I am handling 401 thrown via AJAX. This is working fine in chrome.

But I don't know firefox is getting response 403 Forbidden for same scenario and due to this my check for unauthorized fails.

P.S. AJAX call is on same domain and also no authentication for each AJAX call. I simply check if user logged or not on server side.

Can you please help me out. Thank you in advance.

Parixit
  • 3,829
  • 3
  • 37
  • 61
  • http://stackoverflow.com/questions/29782222/jquery-ajax-call-results-in-401-unauthorized-response-when-in-chrome-or-firefo – Deep Dec 24 '15 at 12:24
  • 1
    @Deep I am calling AJAX to my same domain only and no authentication parameters required in each request. – Parixit Dec 24 '15 at 12:27

0 Answers0