We are experimenting with migrating our old and large CF project from Adobe CF to Lucee.
Our current setup runs on Windows with IIS as the web server connected by AJP (wsconfig.exe) .
We tried to replicate the same with IIS and Lucee/Tomcat using BonCode and mod_cfml by selecting to configure all (IIS) sites during the Lucee installation. After some extra config we were able to view the sites.
Our site has a several subdomains which are configured as separate IIS Sites. With ACF once the user is logged in they stay logged in when navigating between the sub domains.
On Lucee we lose the Session when navigating away to another domain. I realized mod_cfml’s Valve
creates new Tomcat contexts per site in runtime and our subdomains are run as independent websites hence there’s no shared session information between them.
IIS-site1 → myapp/src/site1/ (has its own Application.cfm)
IIS-site1 → myapp/src/site2/ (has its own Application.cfm)
IIS-site3 → myapp/src/site3/ (has its own Application.cfm)
My question is can we make the sites share the session? (I guess no)
Boncode has an HTTP header (well, not Boncode, but the Tomcat valve really) that allows you to override the unique context ID. That said, the web context really should have no bearing on the session sharing, so long as
the application name is the same
the session cookie is shared between sites
An external cache or DB is configured in all sites to store session (I think this bullet is only required if the sites are on different servers)
You can have as many web contexts as you like, even on different servers and they can all share sessions. It is sort of odd though that you have 3 different sites in different web roots and you want them to have the same session. That’s not really a common scenario.
And actually, the more I think of it, Lucee REQUIRES that each unique web root have a separate web context, that’s just how it works. Each web context has a single folder on disk that is the web root that your files are being served from. If you have 3 separate web roots, that’s 3 web contexts in Lucee!
What you’ve done with your proxy really could be accomplished with Boncode in place if you simply ran everything through the same IIS site and use rewrite rules to modify the URLs. But that still feels like a square peg in a round hole. I would let them be 3 separate sites/contexts and work on testing with the same Application name and session cookies.
Oh, BTW I didn’t say the name of the header because I really didn’t think it was your proper fix, but in case anyone saw my message above and is wondering, it’s
If you set that HTTP header in your web server, it will override the unique key that the Tomcat valve uses to decide what web context to use/create. Apache’s mod_cfml defaults to the host name and Boncode/IIS defaults to the IIS site ID. In order for the OP to use this however, they’d need 3 sites in IIS, all using the SAME web root and all setting the same X-Webserver-Context value which would cause the Tomcat valve to see them all as the same site. That’s sort of silly though since you may as well just use one IIS site if you really want them to all have the same web root!
Thanks for the detailed reply. Wanted to give an update.
I tried to exploit the X-Server-Web-Context HTTP header (I patched mod_cfml to do that for us!) you’ve mentioned but since we want to have different DocRoots for the corresponding sites it did not provide a solution but thanks for the idea (Unless we make a big lifting and shifting of code to make them use the single DocRoot the idea won’t work )
Why this setup?
Historically we have these different sites corresponding to different subdomains of our site which share a single Session on ACF without any problem. site1.myapp.com → IIS site1 site2.myapp.com → IIS site2
and so on.
That’s odd, I’m pretty sure it already does that by default, so I’m not sure what you changed.
Yep, I mentioned that above
Have you researched the stuff we told you to look into? i.e. using the same application name with an external cache. You could also put in a ticket for Lucee to consider somehow allowing this, but honestly this behavior is more of a “happy accident” that Adobe CF supported and not anything documented or officially part of CFML IMO.
With this setup we are able to share the Session between our sites. Initial tests are OK as the user is not displayed a login page every now an then.
We are effectively by-passing mod_cfml here so I wonder if you guys find this solution reasonable or hacky. It seems with this method we’ll continue our Lucee migration with this obstacle behind us and most probably come back with some more questions!
Thanks to @bdw429s and @Zackster for suggestions.