Welcome Guest, Not a member yet? Register   Sign In
Cookie Domain Name Problems - That Darn Dot
#1

[eluser]SevenZark[/eluser]
I'm using CodeIgniter's set_cookie() function to set cookies in the browser. I'm doing this, as opposed to using CI's built-in session management, because I have some existing JavaScript code that needs to access the same cookies. The problem is that I need to temporarily "share" those cookies with some direct Ajax calls that the JavaScript makes to an API existing on another system. I'm doing locally-based development, and access my local server as something like 'site.local'

So here's my problem. When a cookie comes down from those Ajax calls, it's associated with the domain "site.local," but when I use CI's set_cookie() function the domain is set as '.site.local' (note the initial dot). In my CI config.php file I have 'cookie_domain' set to 'site.local,' but it seems that CI still automatically forces the initial dot into the cookie's domain parameter. This is causing the Ajax cookies to get out of sync with the ones CI is accessing, because they get set as separate cookies, rather than update the one shared cookie by name.

I realize this isn't an ideal situation, but it's part of a slow transition from the direct Ajax JavaScript handling data, to having CodeIgniter call it and use it in the control layer. I also do not have access to change the way the Ajax API writes the cookies.

Does anybody know how to get rid of this initial dot that CodeIgniter is forcing into the cookies?


Messages In This Thread
Cookie Domain Name Problems - That Darn Dot - by El Forum - 01-31-2011, 10:20 AM
Cookie Domain Name Problems - That Darn Dot - by El Forum - 01-31-2011, 12:24 PM
Cookie Domain Name Problems - That Darn Dot - by El Forum - 04-24-2011, 06:10 PM



Theme © iAndrew 2016 - Forum software by © MyBB