4

I've spent over a day now trying to resolve an issue where two applications use the same relative paths but are under a different "root", and this causes the wrong code base to be accessed for one of the applications.

These are my roots to the two Applications:

  1. \www\Clients\
  2. \www\Other\Clients\

Structure

..www 
....Clients 
......Application.cfc 
....Other 
......Clients 
........Application.cfc

In both Applications there is code that references the relative path (e.g., /clients/content/login.cfm)

I noticed that the ColdFusion Administrator has a Mappings section where the first mapping has a logical path / mapped to the directory path D:/www/.

This works well for the first application since the clients folder is found directly under the www folder, however the second application doesn't work correctly as it too adheres to the same mapping. Therefore instead of searching for /clients/content/login.cfm under the Others folder, it searches yet again under the www folder.

Note: Both applications have a different Application.Name so they are indeed segregated.

The biggest red flag is that we don't experience this issue on our older ColdFusion 9 server, however we are experiencing this on the newer ColdFusion 2016 server.

Sifting through ColdFusion Administrator, I can't seem to find any other settings which could affect the underlying root per Application which could take precedence over the Mappings.

Is there a setting I missed? Was there a drastic change regarding relative paths or mappings between ColdFusion 9 and ColdFusion 2016?

MPaul
  • 1,884
  • 2
  • 17
  • 31
  • 2
    IIRC for older versions of ColdFusion we needed to have the root `/` mapping in the ColdFusion administrator to make things work. That should not be necessary anymore if you switch over to using application specific mappings (defined in your Application.cfc file). I would remove the administrator mapping and add an application specific mapping to your two Application.cfc files defining exactly where that application's files are located. – Miguel-F Apr 11 '17 at 17:09
  • Application specific mapping did indeed resolve the situation, thank you! – MPaul Apr 11 '17 at 18:34

1 Answers1

2

Sifting through ColdFusion Administrator, I can't seem to find any other settings which could affect the underlying root per Application which could take precedence over the Mappings.

Solution: Use application specific mappings.

<cfset this.mappings["/Clients"] = GetDirectoryFromPath(GetCurrentTemplatePath())>

Source

Community
  • 1
  • 1
MPaul
  • 1,884
  • 2
  • 17
  • 31