Problem with duplicate Codeigniter session

I have an application created using codeigniter using the session class and storing session data in a database. The problem is that I get additional session records in my database when my web page loads a css file.

Until recently, I ran my application on a simple VPS host provided by rackspace. The database and Apache were running on the same VPS. Recently, however, I migrated my application to PHPFog to make it easier to scale. I did not have this problem with my previous hosting setup.

enter image description here

The string with the filled value for user_data is my initial session. The remaining three empty sessions are the result of a simple page refresh three times. I seem to have tracked it down to including the css file in my header, when I comment on it or delete it, the problem goes away. This is just this particular css file, other css / js / image files do not cause this problem.

Here is the link to the css file: http://pastebin.com/XfEBNFiC

Does anyone know what could be causing this? Thanks!

UPDATE: I realized that the html of this page can be useful. When commenting on a stylesheet, include in line 13 so that the problem disappears. http://pastebin.com/iBEb4he6

UPDATE2:

$config['sess_cookie_name'] = 'ci_session'; $config['sess_expiration'] = 7200; $config['sess_expire_on_close'] = FALSE; $config['sess_encrypt_cookie'] = FALSE; $config['sess_use_database'] = TRUE; $config['sess_table_name'] = 'ci_sessions'; $config['sess_match_ip'] = FALSE; $config['sess_match_useragent'] = TRUE; $config['sess_time_to_update'] = 300; /* |-------------------------------------------------------------------------- | Cookie Related Variables |-------------------------------------------------------------------------- | | 'cookie_prefix' = Set a prefix if you need to avoid collisions | 'cookie_domain' = Set to .your-domain.com for site-wide cookies | 'cookie_path' = Typically will be a forward slash | 'cookie_secure' = Cookies will only be set if a secure HTTPS connection exists. | */ $config['cookie_domain'] = 'casey.phpfogapp.com'; //$base_url_parts['host']; $config['cookie_path'] = '/'; $config['cookie_prefix'] = ""; $config['cookie_secure'] = FALSE; 
+8
php codeigniter session session-variables hosting
source share
2 answers

In my applications, I put the following code in .htaccess to prevent sending cookies with css / js / images requests:

 #.htaccess # Use Mod_deflate to compress static files <ifmodule mod_deflate.c> <filesmatch ".(js|css|ico|txt|htm|html|php)$"> SetOutputFilter DEFLATE </filesmatch> </ifmodule> # Speed up caching FileETag MTime Size # Expires ExpiresActive On ExpiresDefault "access plus 366 days" # Future Expires Headers <filesmatch ".(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$"> Header set Expires "Sat, 27 Dec 2014 23:59:59 GMT" </filesmatch> 
+3
source share

I had this problem before and the problem was that the CI cookie name could not contain dots.

bad cookie name: .domain.com

smooth criminal: mydomaincom

I used a dotted domain name for the cookie name to include domain cookies (shared cookies from the main domain in all its subdomains). Turns out I found that the only thing I need for this is:

 $config['cookie_domain'] = ".domain.com"; 
0
source share

All Articles