Determining the server name and port in ColdFusion

The following example shows how you can determine the server name/URI and port that the .CFM file is hosted on by using the #CGI# object in ColdFusion.

<cfoutput>
HTTP_HOST -- #CGI.HTTP_HOST#<br/>
SERVER_NAME -- #CGI.SERVER_NAME#<br/>
SERVER_PORT -- #CGI.SERVER_PORT#<br/>
</cfoutput>

The preceding code produces the following output:

Leave a Reply

Your email address will not be published.