Welcome Guest, Not a member yet? Register   Sign In
CI session and redirect function problem in firefox
#1

[eluser]Dominiq[/eluser]
Hello,

I have problem in Firefox with Ci session and redirect() function. I did write this code:
Code:
public function __construct(){
        parent::__construct();
        $login = $this->session->userdata('is_logged');
        if ( $login === FALSE ) {
            redirect('/login', 'location', 301);
        }
    }
And it is redirecting me to login page from that controller ( is_logged = TRUE ). Basically I can't go in that controller. In other browsers like Chrome and Opera it is working. In Firefox even when I did delete code I still get redirect. Does somebody know why?
#2

[eluser]TheFuzzy0ne[/eluser]
Have you tried clearing your browser cache?
#3

[eluser]Dominiq[/eluser]
I did finally have the same problem in Opera browser. After clearing browser cache problem did disappear. So now question is: Does that problem will be only when I develop webapp, or users that will be using this app when I will finish will have the same problem?
#4

[eluser]Herlevsen[/eluser]
Well if your page was cached before the session was set, then it would always redirect you. This would rarely be a problem on a live server, since the webserver should tell the browser not to cache php and html files.

So this is definately not a browser problem. (:
#5

[eluser]TheFuzzy0ne[/eluser]
It's experienced more often whilst developing, but you will probably find that you run into the same problem on your live server. By default, CodeIgniter does a 302 redirect, which instructs the browser that the page has temporarily moved, but it seems that browsers still seem to cache it. If you use a 307 redirect, it instructs the browser that the page has temporarily moved, so the redirect shouldn't be cached.
#6

[eluser]TheFuzzy0ne[/eluser]
Sorry, I just realised you are using a 301 redirect, which means that the file/page has been moved permanently, which is why the browser is caching the redirect. Rather than hitting the server for the same URL again, it simply caches the redirect so it can take you to the redirected URL straight away.
#7

[eluser]Dominiq[/eluser]
So if I will change 301 to 307 this will fix problem? I have that problem in all browsers now :/




Theme © iAndrew 2016 - Forum software by © MyBB