Symlinks addressing incorrect mapped root


My team and I are exploring the feasibility of Lucee and CommandBox.

Currently I have one site, called Site A. I set up Lucee mappings for a shared code directory, called /com. This com directory contains components from another site, Site B. Site B is not configured, nor started as a CommandBox/Lucee instance at this time. The com directory works as expected.

However, I have experienced some difficulty in connecting another folder. Site B contains a subfolder in its repository. On our ColdFusion instances, we map this as admin in the web root of Site A. For my current development setup in ColdBox and Lucee, I attempted replicating this folder. I created the symlink admin inside of Site A’s webroot, linking to the corresponding directory in Site B.

So far, I am able to access the folder without triggering an 400-type error in Apache. And the page passes to Lucee as expected. However, the issue I’m having is that some code from Site B’s admin folder makes reference to /root. I set Site A’s Lucee mappings to point /root and / to the corresponding webroot for Site
A. Lucee/ColdBox on Site A assumes root belongs to Site B, and thus gets incorrect configuration information.

For more information:
I am using Windows 10 with Apache.

Thank you!

You want the short answer?

  1. Don’t use any directory names or file mappings that exist in your server’s root (/etc,/var, /var, /root, etc, etc.) Despite your mapping definition, Lucee will try to resolve paths in these locations to the server root.
  2. Don’t try mapping to /. That’s the server root, not the web root.

There are a bunch of related Lucee tickets, though they may not be the exact same issue:

I set Site A’s Lucee mappings to point /root and / to the corresponding webroot for Site

Until these bugs are fixed… don’t do that. :smiley: :see_no_evil:

1 Like

Hi Michael,

Thank you for your prompt response.

It sounds like what I need to accomplish doesn’t seem feasible within CommandBox, nor Lucee.

I will continue investigating.


I second everything Michael said. Symlinks in general only lead to wailing and gnashing of teeth in my experience. A Lucee CF mappings to / or any actual Linux drive paths are always buggy.

If these are ColdBox apps, I think the “obvious” method here is to share this code via ColdBox modules. Publish the modules as private packages on ForgeBox and install them in all the apps that need to use them! Then instead of trying to keep one copy of the code, you use a package manager to put the code everywhere it needs to be. For example, if I’m using the bcrypt module in 3 different ColdBox sites, I simply

install bcrypt

into each of them. I don’t symlink folders anywhere! Once a folder of code (module) is needed in more than once place, I give it a home outside the app and let the package manager manage it. This is not only modern CF development best practices, but also how pretty much any other web language handles this sort of issue.

Note, it’s possible all your references to “ColdBox” above were typos and you actually intended to say “CommandBox”, in which case none of my previous paragraph applies to you :wink:

As far as the actual errors you’re getting, I didn’t follow most of what you typed. I’m a visual learner and I can’t begin to imagine what you have setup :slight_smile: I’m also not quite clear if you’re saying your setup works on a “traditional” Tomcat-based Lucee installation and not on CommandBox, or if this is the first time you’ve ever tried whatever it is you’re doing.

1 Like

Well, you haven’t said what you need to accomplish. Is it a MUST that certain files are accessible from a /root location which is actually /path/to/siteA/root? If so, then No… that is not possible with Lucee. However, naming the directory root is an unnecessary restriction if you ask me.

If all you need is files from siteA available at siteB, there are many ways to accomplish this… including Brad’s example. Just don’t put it in a directory named root or var or the others I listed above.

Also, this isn’t a Commandbox issue, so be careful not to throw it under the :bus: .

Like Michael said, neither of us quite understand what you’re even after, so I certainly wouldn’t take any of our answers to mean “not possible”. Perhaps you can wrap up a VERY simple self-contained example of what you’re trying to do to help us understand. Without seeing exactly what you’re trying cobble together there’s just too much ambiguity to make a determination.

That’s not a bad idea, Brad. I’ll keep that in mind. Thank you.

Hm, I apologize for a lack of information.

I also apologize for the confusion, at my end, regarding terminology. I’m still new to this and am looking for clarification. I appreciate everyone’s constructive criticism so far.

Let me try to provide more information about what I would like to accomplish.
I need Site A to render code from Site B. However, I need this only in a limited capacity for rendering pages on the web. Essentially, Site B contains code in its web root directory. This admin directory needs to also appear in Site A, with the same web-accessible URL.

Does that provide adequate information?


At its simplest, in CommandBox that should just be

server set web.alias./admin=/path/to/siteB/admin

And then in Lucee, the same server-level mapping (it won’t work in Application.cfc’s this.mappings)

/admin pointing to /path/to/siteB/admin

Honestly, you don’t even need any symlinks. That will create an alias (virtual directory) obeyed by both the CommandBox web server and a CF mapping obeyed by Lucee. And technically, if you don’t have any static files in the admin folder, you don’t even need the web server alias. Just the CF mapping is enough to get CF code served from it.

1 Like

Thanks, Brad. This seems to have accomplished what I needed.