How exactly does Coldfusion serve files with Apache?
So I was helping a colleague debug an issue which seemed to me as an "undefined behaviour" (I may be wrong for defining it as such).
We have coldfusion linked with apache on our server, cf runs on 8500 and apache on 8080
The coldfusion webroot is /opt/coldfusion/cfusion/wwwroot while the apache webroot is /var/www/html
In both webroots he deploys the same file (both files have the same dir structure and name), for example ./sampler/app/index.cfm so he ends up having /var/www/html/sampler/app/index.cfm
<!--- /var/www/html/sampler/app/index.cfm --->
<cfoutput>hello</cfoutput>and /opt/coldfusion/cfusion/wwwroot/sampler/app/index.cfm
<!--- /opt/coldfusion/cfusion/wwwroot/sampler/app/index.cfm --->
<cfoutput>hi</cfoutput>
What he expected to get upon requesting http://250.2.36.996:8080/sampler/app/index.cfm is the output hello since we are pointing to apache, instead we see hi. I decided to give it a look and made a similar setup locally.
When i deleted the file in the cf/wwwroot i got output hello but when i brought the file back i got hi. I arrived at the conclusion ColdFusion is checking both webroots and prioritizing its own webroot when a file exists there. After a year of experience in setting up our coldfusion environments this is the first time i am noticing this behaviour and curious about it.
Hopefully someone can explain to me what is going on here and how to actually get the file apache is serving using the <IP:PORT> (I know using virtual hosts with a domain configured is one way)
Thanks! 🤓
