Forum Discussion

Rob_Higginbotha's avatar
Rob_Higginbotha
Icon for Nimbostratus rankNimbostratus
Feb 26, 2016

HTTP to HTTPS redirect and Append to URL

I have this VIP and I want to add an irule that will take a URL like http://iamqa.something.com and change it to HTTPS and append the following https://iamqa.something.com:8443/aveksa/admin. Basically, I just want the user to type iamqa.something.com in their browser and get redirected to https://iamqa.something.com:8443/aveksa/admin

 

Any help would be great. Everything I try it fails.

 

1 Reply

  • Hi Rob,

    if the HTTP virtual server is exclusively used for the redirect, then use this iRule...

    when HTTP_REQUEST {
        HTTP::redirect "https://iamqa.something.com:8443/aveksa/admin"
    }
    

    if the HOST-name

    iamqa.something.com
    is exclusively used for the redirect, then use this iRule...

    when HTTP_REQUEST {
        if { [string tolower [HTTP::host]] eq "iamqa.something.com" } then {
            HTTP::redirect "https://iamqa.something.com:8443/aveksa/admin"
        }
    }
    

    if just the

    /
    (website root) of the HOST-name
    iamqa.something.com
    should be redirected, then use this iRule...

    when HTTP_REQUEST {
        if { [string tolower [HTTP::host]] eq "iamqa.something.com" } then {
            if { [HTTP::uri] eq "/" } then {
                HTTP::redirect "https://iamqa.something.com:8443/aveksa/admin"
            }
        }
    }
    

    Cheers, Kai