– Common Function Library Project

GetSecureURL([domain][, path][, queryString][, port])

Last updated May 10, 2009


Jon Hartmann

Version: 0 | Requires: CF5 | Library: StrLib

This function takes cgi information and creates a URL for an https to the current page. Each section can be overridden to allow it to create URLS for other locations.

Return Values:
Returns a string


<cfdump var="#GetSecureURL()#">


Name Description Required
domain url to secure No
path page to secure No
queryString queryString for page No
port additional port to use in url No

Full UDF Source:

 Creates an HTTPS URL for the current page, or for given page information.
 @param domain      url to secure (Optional)
 @param path      page to secure (Optional)
 @param queryString      queryString for page (Optional)
 @param port      additional port to use in url (Optional)
 @return Returns a string 
 @author Jon Hartmann ( 
 @version 0, May 9, 2009 
<cffunction name="GetSecureURL" output="false" returntype="string">
    <cfargument name="domain" typ="string" required="false" default="#cgi.server_name#" />
    <cfargument name="path" typ="string" required="false" default="#cgi.script_name#" />
    <cfargument name="queryString" typ="string" required="false" default="#cgi.query_string#" />
    <cfargument name="port" typ="string" required="false" default="#cgi.server_port#" />
    <cfset var HTTPSURL = "https://" & arguments.domain />
    <cfif IsNumeric(arguments.port)>
        <cfset HTTPSURL = HTTPSURL & ":" & arguments.port />
    <cfset HTTPSURL = HTTPSURL & arguments.path />
    <cfif Len(arguments.queryString)>
        <cfset HTTPSURL = HTTPSURL & "?" & arguments.queryString />
    <cfreturn HTTPSURL />


Latest Additions

Raymond Camden added
November 04, 2017

Leigh added
May 11, 2016

Raymond Camden added
May 10, 2016

Kevin Cotton added
May 05, 2016

Raymond Camden added
April 25, 2016

Created by Raymond Camden / Design by Justin Johnson