CodeIgniter Forums
Cookies only setting in certain browsers - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Cookies only setting in certain browsers (/thread-58313.html)



Cookies only setting in certain browsers - El Forum - 06-01-2013

[eluser]KristenBlackburn[/eluser]
Ive tested my project on Maxthon, IE10, Chrome, Opera, and Firefox. Also installed cookie viewers for each browser, the only browsers which set cookies are chrome and firefox, the rest of the browsers fail to set cookies, leaving the session to return The action you have requested is not allowed.

define('CI_VERSION', '2.1.3');

$config['cookie_prefix'] = "";
$config['cookie_domain'] = ($_SERVER['SERVER_NAME'] == 'localhost' ? '' : preg_replace('/^www\./', '', $_SERVER['SERVER_NAME']));
$config['cookie_path'] = "/";
$config['cookie_secure'] = TRUE;


A little help on whats going wrong would be appreciated, thank you



Cookies only setting in certain browsers - El Forum - 06-01-2013

[eluser]pzntec[/eluser]
I think your globals and the function preg_replace confuses things. The preg_replace should be configured into the .htaccess file instead.

Have you tried the default settings?
<code>
$config['cookie_prefix'] = "";
$config['cookie_domain'] = "";
$config['cookie_path'] = "/";
$config['cookie_secure'] = FALSE;
</code>