I have an application.cfm file that checks to see the CGI.SERVER_NAME value,
and port number, and assigns the application values accordingly (I use just one
application.cfm file for Dev, Test and Production environments).

The Prod environment is secure, while dev and test are not. So the URL is
https:// for Prod. The Urls for all three are very different. With only Dev
and Prod sharing the port number. Below is an example of the application.cfm
file:

<cfif (UCase(CGI.SERVER_NAME) CONTAINS "XYZ") AND (#CGI.SERVER_PORT# EQ
"8881")>
<!--- Test environment --->
<cfelseif (UCase(CGI.SERVER_NAME) CONTAINS "XYZ") AND (#CGI.SERVER_PORT# EQ
"8880")>
<!--- Development environment --->
<cfelse>
<!--- Production --->
</cfif>

Prod's URL is like [url]https://prod.abcdef.com/[/url] .

My problem is that I'm calling a CFM page that itself calls a CFC component.
The CFC component references "application.xyz" variable, but seems to fail
randomly and use the Dev variables while in Prod. The CFC is called during a
loop, so it may work for lets say 200 times during the loop, then start using
the Dev variables for some reason.

I've had other developers look at the code and nothing seems out of the
ordinary. I'm at a loss as to why this is happening, but I have to find a
solution. Has anyone got an answers for me?

Thanks.