Forum Discussion

Beau_Monday_107's avatar
Beau_Monday_107
Icon for Nimbostratus rankNimbostratus
Sep 15, 2005

Redirect to https only on the login page?

We want to be able to force a user to enter an HTTPS session if they arrive at the login page, but the rest of the application can operate under HTTP. I am trying to use this rule to accomplish this:

 

 

when HTTP_REQUEST {

 

if { [HTTP::uri] ends_with "SYS_login.asp" } {

 

HTTP::redirect "https://[HTTP::host]/[HTTP::uri]" }

 

}

 

 

Unfortunately, I get stuck in a redirect loop if the user already has specified "https://" when entering the site.

 

 

Suggestions?

1 Reply

  • unRuleY_95363's avatar
    unRuleY_95363
    Historic F5 Account
    Yeah, you can make sure the rule is only on your http virtual and not on your https virtual.

    Or you could try adding this extra check:
    when HTTP_REQUEST {
       if { ([TCP::local_port] == 80) and ([HTTP::uri] ends_with "SYS_login.asp") } {
          HTTP::redirect "https://[HTTP::host][HTTP::uri]"
       }
    }