bcit-ci / CodeIgniter

Open Source PHP Framework (originally from EllisLab)
https://codeigniter.com/
MIT License
18.27k stars 7.62k forks source link

Firefox session issue #1102

Closed beardied closed 12 years ago

beardied commented 12 years ago

I have a simple login in system which all works in ie however in firefox it drops the session when changing page.

I have a login view which takes the log in and when sucessfull redirects to the home page where it loads a different header if logged in. This works, however when i refresh or click another link on my page i loose the session.

This only happens in Firefox, in IE8 it works perfectly, i havent been able to try any other browsers.

I cant find anything on here or google search to help fix this problem, i even suspected the SI_session library so ommited the session on autoload and coded usual SESSION with start_session etc and i get exactly the same outcome.

I have read up somewhere that when Firefox see's a http:// request it views it as a new session maybe this is the reason somewhere within the codeigniter code. I tried changing the base url in config.php by removing the http:// but no luck!

Any help would be apreciated! Im running out of hair to pull out!

goztrk commented 12 years ago

This could (and probably) not be a CI issue. You can do these steps to determine the problem:

  1. Try to login in Chrome or Opera. See if problem exists.
  2. Use one of the login libraries that shared public (Ion_auth, Tank_auth, bitauth). Install them to a fresh copy of CI and try it. Then install one of them to the copy that you are working on and try it.
  3. Uninstall and reinstall Firefox. Then try again on your login system and one of the shared login system.

And ask it on http://codeigniter.com/forums

onigoetz commented 12 years ago

I had a problem like this some time ago.

Maybe yours is the same.

I did a lot of debugging on my CI app, with firephp. when you have the firebug panel open with firephp, by default it adds a string to your user_agent header. but only when the firebug panel is open.

and as the session manager detected a user_agent change and invalidated the session. this happened me a lot.

the fix was to : update to the latest firephp version (server library) and in the options panel of firephp to uncheck the option "send user_agent" or something like that.

I hope this helps you to somehow figure out what your problem is.

jeremyml commented 12 years ago

I had this same problem. Codeignter 2.1 would dump sessions when loading new pages in firefox but not IE or Chrome. I disabled FirePHP 0.7 and this problem no longer occured. Fixed, thank you!

beardied commented 12 years ago

Well thanks for all the replies, sorry my reply has been a bit late, been very busy.

I tried all of the above, even pulle dmy hair out and i found the problem, in my config file i had my $config['base_url'] = 'http://mysite.com/';

Simply added the www so reads $config['base_url'] = 'http://www.mysite.com/';

Problem solved, i believe this causes Firefox to restart the session by not having the www!

Now to find a hair grow ointment!

Thanks for everyones input!