Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Randomly Losing Session Variables Only In Google Chrome & URL Rewriting

Using Google Chrome, I'm seemingly losing/corrupting session data when navigating between pages (PHP 5.0.4, Apache 2.0.54). The website works perfectly fine in IE7/8, Firefox, Safari & Opera. The issue is only with Google Chrome.

I narrowed down the problem. I'm using search friendly URL's, and hiding my front controller (index.php) via a .htaccess file. So the URL looks like: www.domain.com/blah/blah/ Here's the .htaccess file contents:

Options +FollowSymlinks 
RewriteEngine on
#allow cool urls 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*) index.php [L] 
#allow to have Url without index.php 

If I remove the .htaccess file, and expose the front controller in the URL: www.domain.com/index.php/blah/blah/, Chrome works perfectly fine.

Any thoughts ideas? I'm thinking it's some kind of problem with how Chrome identifies what cookie to use and send to the server? This happens in Chrome 4 & 5. Thanks!

like image 684
Toby Avatar asked Jun 01 '10 21:06

Toby


People also ask

How do I keep a chrome session alive?

The solution is to “refresh” the idle tab (which reloads the website) by clicking the curved arrow icon at the right side of the Web address bar. If you would rather avoid the time-out problem, switch to the Google Chrome browser (see tinyurl.com/zkukxzy). It also has a time-out feature.

Can you see session variables in Chrome?

No, you cannot view session state variables at client side. Session state is stored at server, and Client browser only knows SessionID which is stored in cookie or URL. Sessions are identified by a unique identifier that can be read by using the SessionID property.

Where is session stored in Chrome?

Session data is stored on the server only, and cannot be accessed by the client. If you'd like to store data accessible by the client and the server, use cookies.


1 Answers

I had the same issue, and to fix it I only had to create a favicon.ico and place it in the webroot - otherwise I could see using Fiddler that a 404 resulted for this with every page request from Chrome (despite me not actually linking to a favicon in the page markup).

In my mind this is clearly a bug in Chrome, as the lack of a favicon should have no bearing on session data.

like image 194
BrynJ Avatar answered Sep 18 '22 11:09

BrynJ