• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

New web applications on centos 7 server, calling other Application.cfc files from other directory

Explorer ,
May 20, 2021 May 20, 2021

Copy link to clipboard

Copied

Good morning,

 

      I have ran into a rather peculiar issue.  I have a CentOS 7 server with ColdFusion 2018 installed and configured.  Apache virtual directories are configures with correct directory structure to each web application document root via Plesk.  I'm going to use two web applications in this example, although I am experiencing the same issue with others.  

      I have one web application that when navigated to loads the correct Application.cfc file in it's directory root: r1gup.egtyctest.com.  The other web application, utgup2.egtyctest.com, is navigating to the r1gup.egtyctest.com Application.cfc file.  I placed a javascript alert on each Application.cfc files to display which Application.cfc file is being called and what the current hostname is being requested.  You can see the message when you navigate to either URL mentioned above.  FYI, these applications are in testing, and you will get a warning message when you navigate to these URL's to proceed.  

     The web root of each application on the server is below:

Working application: /var/www/vhosts/r1gup.egtyctest.com/httpdocs

Application using aboves Applicaiton.cfc file: /var/www/vhosts/utgup2.egtyctest.com/httpdocs

 

The other strange occurence i'm having with this is if i restart the coldfusion or apache server, the issue can reverse.  I will be able to navigate to the utgup2.egtyctest.com application and it will load the correct Application.cfc file and then r1gup.egtyctest.com will load utgup2.egtyctest.com Application.cfc file.  

 

After all my testing, I do not think this is Apache related.  The virtual hosts files for all the web applications have all the correct settings for the document roots, and if I default the first web page to be loaded with a simple index.html file, the correct page in the correct directory gets loaded.  This seems to be ColdFusion looking for the first available Application.cfc file, and loading that file, not respecting the web applications document root folder.  

 

Are there any other mappings I am missing to get the correct Application.cfc files loaded for each of my web applications?  Any insight will be greatly appreciated.

 

-Daniel

 

Views

321

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 2 Correct answers

Community Expert , Jun 06, 2021 Jun 06, 2021

Hi @DanielTheProgrammer ,

The screenshots actually contradict what you originally said. The folder names r1rise.egtyctest.com and chgup.egtyctest.com were not in your original description.

 

quote

1st screenshot: I am being taken inside the r1rise.egtyctest.com folder...

 

2nd screenshot: I am being taken inside the chgup.egtyctest.com folder ...

 


By @DanielTheProgrammer

 

No, not necessarily. Those folder names are artificial. They had been added by hand in the Javascript, as follows

 

alert("In r

...

Votes

Translate

Translate
Explorer , Jun 10, 2021 Jun 10, 2021

Thank you BKBK for all the assistance with this issue, it has been resolved.  After spending time with Brian Bockholder and really reviewing the configuration of the server, we found the issue.  There is a checkbox in the Coldfusion Administrator page, under Server Settings -> Caching, "Cashe web server paths".  This checkbox was checked and was preventing my web applicaitons from loading their own web server paths.  After un-checking this box, and restarting the Coldfusion server, all my web ap

...

Votes

Translate

Translate
Community Expert ,
May 22, 2021 May 22, 2021

Copy link to clipboard

Copied

It is unclear to me whether:

 

1) the Application.cfc files have distinct paths. That is, respectively,

 /var/www/vhosts/r1gup.egtyctest.com/httpdocs/Application.cfc 

 /var/www/vhosts/utgup2.egtyctest.com/httpdocs/Application.cfc 

 

2) you gave each application a distinct name.

You can do that using the following setting in the respective Application.cfc files:

<cfset this.name="myR1gupApp"> <!--- in the r1gup Application.cfc file --->

<cfset this.name="myUtgup2App"><!--- in the utgup2 Application.cfc file --->

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 24, 2021 May 24, 2021

Copy link to clipboard

Copied

Hello BKBK,

 

     1) the Application.cfc file do have distinct paths just as you laid out: 

/var/www/vhosts/r1gup.egtyctest.com/httpdocs/Application.cfc 

 /var/www/vhosts/utgup2.egtyctest.com/httpdocs/Application.cfc 

 

     2) All the applications do have their distinct name on the Application.cfc files

      <cfset this.name="r1gup.egtyctest.com">

      <cfset this.name="utgup2.egtyctest.com">

 

Thanks,

 

Daniel

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 25, 2021 May 25, 2021

Copy link to clipboard

Copied

OK. 

There is an idea that might or might not be related. But it's worth trying, to see if it helps.

 

Is ColdFusion perhaps confused by the dots? I ask because the following happened.

 

I created a directory and named it dir1.dir2. I placed a CFC called Test.cfc in it. When I ran the following code, I got the error "Could not find the ColdFusion component or interface dir1.dir2.Test".

 

My advice is that you should rename the application-paths and application-names from

 

/var/www/vhosts/r1gup.egtyctest.com/
/var/www/vhosts/utgup2.egtyctest.com/

 

and

 

<cfset this.name="r1gup.egtyctest.com">
<cfset this.name="utgup2.egtyctest.com">

 

to, respectively,

 

/var/www/vhosts/r1gup_egtyctest_com/
/var/www/vhosts/utgup2_egtyctest_com/

 

and

 

<cfset this.name="r1gup_egtyctest_com">
<cfset this.name="utgup2_egtyctest_com">

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 27, 2021 May 27, 2021

Copy link to clipboard

Copied

Thank you for the suggestion BKBK, I did remove the dots in the Application.cfc files, and still not luck.  I currently have a support ticket open with the company we purchased the license from.  We are using hours that they provided to help with any issues.  Once resolved I will post the fix here on this post.  

 

-Daniel

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 30, 2021 May 30, 2021

Copy link to clipboard

Copied

I am unable to reproduce your result. I tested by opening the 2 pages https://r1gup.egtyctest.com/ and https://utgup2.egtyctest.com/ in the browser. I then pressed F5 many times to refresh each page.

 

I got the expected result each time, no matter how many times I refreshed.

 

BKBK_0-1622371665208.png

 

BKBK_1-1622371715317.png

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 30, 2021 May 30, 2021

Copy link to clipboard

Copied

Just to confirm that we are thinking about the same thing: did you place your Javascript test code as follows

<!--- Application.cfc --->
<cfcomponent >
<!---
...
--->
	<cffunction name="onRequestStart" returntype="boolean">
	 <cfargument name = "targetPage" type="String" required="true"> 
	 
	 <script type="application/javascript">
	      alert("Application.cfc file in domain: " + window.location.hostname)
     </script>
     
     <!--- The rest of the code --->
     
     <cfreturn true>
	</cffunction>
<!---
...
--->
</cfcomponent>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 01, 2021 Jun 01, 2021

Copy link to clipboard

Copied

Hi BKBK,

 

    Yes, I do have the javascript within the <cfunction name="onRequestStart"> block.   The screenshots confirm the issue I'm experiencing.  

1st screenshot: I am being taken inside the r1rise.egtyctest.com folder and not the r1gup.egtyctest.com.

2nd screenshot: I am being taken inside the chgup.egtyctest.com folder and not the utgup2.egtyctest.com.

 

Thanks,

Daniel

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 06, 2021 Jun 06, 2021

Copy link to clipboard

Copied

Hi @DanielTheProgrammer ,

The screenshots actually contradict what you originally said. The folder names r1rise.egtyctest.com and chgup.egtyctest.com were not in your original description.

 

quote

1st screenshot: I am being taken inside the r1rise.egtyctest.com folder...

 

2nd screenshot: I am being taken inside the chgup.egtyctest.com folder ...

 


By @DanielTheProgrammer

 

No, not necessarily. Those folder names are artificial. They had been added by hand in the Javascript, as follows

 

alert("In r1rise.egtyctest.com file, hostname: " + window.location.hostname);

alert("Inside chgup.egtyctest.com, Inside hostname:" + window.location.hostname);

 

Because the strings are added manually, they could be anything. They say nothing about the folder.

The only value that is real is window.location.hostname. And it is, respectively, r1gup.egtyctest.com and utgup2.egtyctest.com, as expected.

 

In short, there is no Application.cfc problem. What you have been seeing is just the result of a typing error in the Javascript's alert calls. If you want the Javascript to reflect what you observe, then change the alerts, respectively, to:

 

alert("In r1gup.egtyctest.com file, hostname: " + window.location.hostname);

alert("In utgup2.egtyctest.com file, hostname: " + window.location.hostname);

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 10, 2021 Jun 10, 2021

Copy link to clipboard

Copied

LATEST

Thank you BKBK for all the assistance with this issue, it has been resolved.  After spending time with Brian Bockholder and really reviewing the configuration of the server, we found the issue.  There is a checkbox in the Coldfusion Administrator page, under Server Settings -> Caching, "Cashe web server paths".  This checkbox was checked and was preventing my web applicaitons from loading their own web server paths.  After un-checking this box, and restarting the Coldfusion server, all my web applications would navigate to the correct paths.

 

-Daniel

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation