Two Coldbox Apps, one session?

If I have two coldbox applications and would like them to share session information what’s the best way to do this?

I’ve tried setting the name in application.cfc the same and I’m still getting two sessions. Does every parameter need to be the same?

Thanks

Jonathan

Do you mean sessions as in I set cookie to define session?

Check and see if your session ids are changing. If they are, are the two apps on different subdomains which is causing new cookie assignments?

Another idea, if you’re on Railo or Lucee, is to use an external session store like our Couchbase Cache Extension.
http://www.ortussolutions.com/products/couchbase-lucee

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

Yes, I have www.domain.com and site2.domain.com. I basically need a simple way to only login once.

Are you using Adobe CF or Railo/Lucee? The setDomainCookies is the setting I think you want. It makes your session cookies work for both domains. That setting hasn’t worked in Railo in the past. I actually just dug up the Railo ticket number where it was supposedly fixed, but still reported broken a few weeks ago on this mailing list.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

CF11.

  1. Enable setDomainCookies in your application
  2. clear cookies
  3. hit domain one and record session id cookie
  4. hit domain two and see if the cookies changes

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

Thanks my sessionids are the same now. For some reason my cbstorage isn’t.

Well I was wrong my wrong. My CFID and CFTOKENs are the same but the sessionids are different.

Ahh, using J2EE sessions. What is the domain set to on the “set cookie” header for jsessionid? I think the setDomainCookies might not apply to your jsessionid since it’s set by Tomcat. You can either try setting the client cookies manually like so:

this.setClientCookies=false;

Or you can try Jason Dean’s tutorial into making Tomcat use session cookies:

http://www.12robots.com/index.cfm/2013/8/20/Making-JEE-Session-Tokens-Domain-Cookies-in-Tomcat

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com