Forum Discussion

F5Hopper_28651's avatar
F5Hopper_28651
Icon for Nimbostratus rankNimbostratus
Sep 20, 2012

string tolower? and HTTPS redirects

I have a few rules like this..

 

when HTTP_REQUEST {

 

if { [HTTP::uri] eq "/Recovery.aspx" } {

 

HTTP::redirect "https://qa.www.google.com/Recovery.aspx"

 

}

 

}

 

when HTTP_REQUEST {

 

if { [HTTP::uri] eq "/Signup.aspx" } {

 

HTTP::redirect "https://qa.www.google.com/Signup.aspx"

 

}

 

}

 

my issue is if I use a string tolower command it doesnt redirect to https://, Im trying to make it so the users changes the URL to /signup.aspx that it also redirects to HTTPS://

 

my other question is can I group these rules together?

 

Thanks

 

 

2 Replies

  • Merge the two iRules by simply moving on 'if" block into the othe rule.

     

     

    You should post the code of your iRule does not work, so people can see how you are using the tolower function.
  • ok thanks I have made my rule and its working now.

     

     

    when HTTP_REQUEST {

     

    if { [string tolower [HTTP::uri]] eq "/application.aspx" } {

     

    HTTP::redirect "https://qa.www.google.com/Application.aspx"

     

    }

     

    if { [string tolower [HTTP::uri]] eq "/customerportal.aspx" } {

     

    HTTP::redirect "https://qa.www.google.com/Login.aspx"

     

    }

     

    if { [string tolower [HTTP::uri]] eq "/login.aspx" } {

     

    HTTP::redirect "https://qa.www.google.com/Login.aspx"

     

    }

     

    if { [string tolower [HTTP::uri]] eq "/recovery.aspx" } {

     

    HTTP::redirect "https://qa.www.google.com/Recovery.aspx"

     

    }

     

    if { [string tolower [HTTP::uri]] eq "/signup.aspx" } {

     

    HTTP::redirect "https://qa.www.google.com/Signup.aspx"

     

    }

     

    if { [string tolower [HTTP::uri]] eq "/activateaccount.aspx" } {

     

    HTTP::redirect "https://qa.www.google.com/ActivateAccount.aspx"

     

    }

     

    }

     

     

    it ended up that in my-

     

    if { [string tolower [HTTP::uri]] eq "/activateaccount.aspx" } {

     

    I had used the real URI of "/ActivateAccount.aspx", this line needed to be lowercase in order to work.

     

     

    Now is there any way of making the HTTP::redirect more generic? so I can use it for other sites in DEV...so https://dev1.www.google.com?