Force SSL in Coldfusion

Have you ever wanted to force SSL on page in coldfusion? Well, it is quite simple. Just add the following code to the top of the page you want SSL on.

<cfif CGI.https is "Off">
<cflocation url="https://#cgi.server_name##cgi.script_name#?#cgi.query_string#" addtoken="no" />
</cfif>

Bam, all set!

Comments
BlogCFC was created by Raymond Camden. This blog is running version 5.9.1.002. Contact Blog Owner