HTTP to HTTPS redirect
In some of my applications I only want the user to connect on a Secure Sockets Layer (SSL). I have already installed my SSL Cert and need to know how to force any traffic not on SSL to be on SSL.
An example of when you may want to do this could be when a user on your site is entering sensitive information such as credit card details.
Its not good to rely on the fact you have taken them via a post to a https page, your user could change the URL or gets to your page in a different way. You should always make sure they are on a SSL.
Note: The example below will depend on the particular cgi variables available on your own server .
secureSSL.cfc
2 <cfif CGI.SERVER_PORT NEQ "443">
3 <cfoutput>true dasasdsd sdsd sds d </cfoutput>
4 <cflocation url="https://#cgi.server_name##cgi.script_name#?#cgi.query_string#" addtoken="no">
5 </cfif>
6</cffunction>
Then on any page you want to secure just create the cfc and run the function. In my case its something like this...
2securityCFC.securePageThisPage();





There are no comments for this entry.
[Add Comment] [Subscribe to Comments]