By default, I believe that CF cookies must match the full domain name. You can specify the domain you want with the cfcookie tag: http://www.cfquickdocs.com/#cfcookie
That being said, I’m not sure what settings are used when you just do cookie.myValue = ‘’
Either way, a small amount of HTTP introspection should tell you what’s going on. For starters look at the cookies being sent by the browser to the server. Is the jsessionID changing when the domain changes.
Second, look at the cookie “set” being sent from the server to the browser, what domain does it specify, if any?
Finally, I’m pretty sure the issue is that your site is getting reinitialized with domain x, and that gets stored as an application setting for the baseSESURL. Then, later on, when you try and hit the other domain, any setNextEvent is throwing you back to the original. That could be an annoying issue regardless of the cookie domain bit (being redirected to a different domain than the one you were on)
Like Luis said, if you want to use your site on both domain.com and www.domain.com, you need to register an interceptor that sets the base SES URL on every request. My site at work is configured to allow any domain to access it and it will always use the current domain it is on for any redirects. Here’s my interceptor:
<cfset arguments.event.setSESBaseURL(“http” & ((event.isSSL())? “s” : “”) & “://” & cgi.http_host & ((len(trim(getSetting(“AppMapping”))))?"/" : “”) & getSetting(“AppMapping”) & “/index.cfm”) >
ColdBox Platform Evangelist
Ortus Solutions, Corp