Created
September 13, 2015 23:19
-
-
Save ghidinelli/2e7fb5962f39b7cc6508 to your computer and use it in GitHub Desktop.
getIsSecure() for ColdFusion with or without common load balancers/firewalls
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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