Skip to content

Instantly share code, notes, and snippets.

@ghidinelli
Created September 13, 2015 23:19
Show Gist options
  • Save ghidinelli/2e7fb5962f39b7cc6508 to your computer and use it in GitHub Desktop.
Save ghidinelli/2e7fb5962f39b7cc6508 to your computer and use it in GitHub Desktop.
getIsSecure() for ColdFusion with or without common load balancers/firewalls
<cffunction name="getIsSecure" output="false" access="public" returntype="any" hint="Determine if the request is encrypted via HTTPS directly or via BIG/IP">
<cfreturn (structKeyExists(CGI, "server_port_secure") AND isBoolean(CGI.server_port_secure) AND CGI.server_port_secure EQ true)
OR (structKeyExists(CGI, "bigipssl") AND isBoolean(CGI.bigipssl) AND CGI.bigipssl EQ true)
OR (structKeyExists(getHTTPRequestData().headers, "X-Forwarded-Proto") AND getHTTPRequestData().headers["X-Forwarded-Proto"] EQ "https") />
</cffunction>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment