CakePHP session error : User-Agent must be consistent
I noticed some erratic behavior with CakePHP sessions and finally tracked down the error. I have FireBug installed with an extension called FirePHP. When FireBug is enabled, I noticed that my User-Agent tends to vary.
Sometimes my browser’s user agent reads :
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.8) Gecko/20100202 Firefox/3.5.8 FirePHP/0.4
Sometimes it reads :
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.8) Gecko/20100202 Firefox/3.5.8
Whenever the User-Agent changes, CakePHP resets the session. This means that I can’t view 3-4 pages on the site before being logged out.
This is the firebug extension that caused the problem.
https://addons.mozilla.org/en-US/firefox/addon/6149
Here’s a link to an error report on FirePHP’s forums
http://n2.nabble.com/FirePHP-and-CakePHP-Session-Reset-tp4671294ef842658.html
This is a great add-on called HTTPFox I used to track down this error.
https://addons.mozilla.org/en-US/firefox/addon/6647
Comments(4)
This error can also arise when you have Flash or Java applets which interact with CakePHP, since they have their own user agent strings which don’t match the browser.
I think this is configurable. In config.php, set “sess_match_useragent” to false.
Right on. Thanks for the tip, Matt.
[...] das sessões se as requisições estão vindo do mesmo browser (por segurança). Nesse link é relatado um bug do FirePHP (usado junto com o Firebug) que pode mudar o USER AGENT retornado [...]
Why session var reset after browser refreshing in cakephp 1.3?…
I am writing a application using cakephp 1.3.
My code works perfectly on my localhost, but after uploading to godaddy.com, I found the session var is reset after refreshing the page….
I did google search and tried many things:
1. I have security.leve…