Skip to main content
Known Participant
July 16, 2009
Question

Redirect to https

  • July 16, 2009
  • 1 reply
  • 816 views

Ok, I've searched thru the forums but I'm still having some problems getting this to work. Here's the code below that I'm using:

<!--- set up the getRequest method for easy access ---> 

<cfset oRequest = getPageContext().getRequest() /> 

<cfif NOT oRequest.isSecure()> 

    <cflocation url="https://#oRequest.getServerName()##oRequest.getRequestURI()#" addtoken="false" /> 

</cfif> 

When using this code, the page gets stuck in a continuous loop trying to load. I want to make it so that if anyone tries to load the page using http, they will get redirected to the same page but loaded thru https. Any ideas on what I'm doing wrong? I'm working with a blank CF page at the moment while I try to get it figured out.

    This topic has been closed for replies.

    1 reply

    Participating Frequently
    July 16, 2009

    Your code works for me so think you might have an Application.cfm or

    some other file that redirects you back to http:// when you're on

    https://.

    Mack

    J_TremainAuthor
    Known Participant
    July 16, 2009

    I would like to say that I don't think that's it. In my Application.cfm file, the only thing I have declared is session management turned on.

    Participating Frequently
    July 17, 2009

    Can you enable debugging and see what files are actually

    included/executed before the cflocation ?

    Mack