Share session vars

Hello everybody

I have two Coldbox applications in the same domain.

Like this:

/domain.com
     /public
         /config/Coldbox.cfc
         Application.cfc
             with this.name="app-public";
     /manager
         /config/Coldbox.cfc
         Application.cfc
             with this.name="app-manager";

Is there a way to share sessions?

I could use a cookie but I could only use simple variables…

Not if the application names differ. You could use a wrapper object from the cbstorages module to encapsulate all session storage.

In reality, I would recommend you re-think the two-app structure and move to

  • a single CF application
  • a single ColdBox app
  • Two ColdBox modules with entry points /public and /manager respectively.

Now, not only can your two apps share the same session, but they can also share all ColdBox settings, models, modules, you want. ColdBox modules basically provide you with the closest thing to separate apps but still actually a single app. Each module can still have its own

  • handlers
  • views
  • layouts
  • models
  • interceptors
  • settings
  • routes
  • etc
2 Likes