Web-accessible server mappings return wrong application context in Lucee 7

Lucee 7.0.2.106
Loader Version 7.0.1.100
Servlet Container Apache Tomcat/11.0.15
Java 24.0.2 (Eclipse Adoptium) 64bit
OS Windows Server 2022 (10.0) 64bit

Setup:
Directory structure:
/sites/site1
/sites/site2
/sites/global

site1 and site2 each have their own Application.cfc (THIS.name=“site1” and THIS.name=“site2”) and an info.cfm at their root
Common shared code lives in /sites/global, mapped in Lucee server admin as /global = “/sites/global”
Mapping is set to: Resource (Primary), web-accessible, with inherited type/mode/inspect settings

/sites/global/detail.cfm contains , intended to pull each site’s own detail.cfm

Problem:
When accessing http://site2.com/global/detail.cfm after previously visiting http://site1.com/global/detail.cfm, the page renders under site1’s application context — getApplicationSettings() returns name = “site1” instead of “site2”.
Attempted fix: Adding a /global mapping in each site’s Application.cfc had no effect.

Marc, to help everyone following along, can you clarify what web server is serving those urls you mention?

Is it apache? Or the Tomcat web server (which normally serves your Lucee admin, albeit at a different port)? Or might you be running Lucee under Commandbox, which has yet another web server (undertow)?

I’m sensing it may be the first case. In that case, how the domains map to folders may be controlled instead by apache config rather than Lucee. (And are you using mod cfml, or are you unaware of it?)

As for the Lucee admin mappings, those don’t affect how incoming urls are processed: like with ACF, they affect how internal calls to folders can be virtualized (cfc invocations, cfinclude calls, custom tag calls), using one virtual folder name to point to a different one physically.

Maybe someone else will readily spot what’s amiss for you, but if not then do let us know your web server…or if my questions alone may help you spot what’s amiss.

Yes it’s apache http via ajp. Apache and tomcat are loading the correct page in each context. Each of the sites detail.cfm contains:

detail.cfm dumps getApplicationSettings() at root of site1.
(dump of site2)

which shows the message "
detail.cfm dumps getApplicationSettings() at root of site1." or "
detail.cfm dumps getApplicationSettings() at root of site2." depending the site.

it’s the details in getApplicationSettings() that are not right.

Apart from adding the secret to the connector the apache and tomcat vhosts settings were not changed from lucee 6 to 7.

I also tried adding

Context docBase=“C:\sites\global" path=”/global"
Context docBase=“C:\sites\global" path=”/global"

to tomcats server.xml for each host and it didn’t help

This is most likely because in Lucee 7.x, they no longer support mult-context deployments :

You will need to either enable multi-mode in the cfconfig file manually, OR move to a context-aware deployment (e.g. Docker or Tomcat serving the application from within its context).

multi mode in lucee7+? how do you do that?

You don’t, there is some isolation per mini web context but like ACF there is a single main context

This repo demonstrates what you can do

I read the repo and it seems to me to be a test suite. Is there a solution hiding in there?

Yeah it’s a test suite, they rock as they demonstrate what works?

Do you have specific questions after reading the documentation?

Happy to improve the docs

Great set of tests. It took me a long time to figure out what was going on. That test would have been helpful to diagnose. It took quite a while to figure out what was happening.

glad they helped!

any feedback on what you figured out/concepts/etc which helped you?

I’d love to know anything we can improve on the docs for the next person!