For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

sundogbrew's avatar
sundogbrew
Icon for Altocumulus rankAltocumulus
Jul 31, 2014

rule http::host change

I asked a question yesterday which was answered but I guess I need something different.

I asked to redirect to the host name of the URL which would work, but I need to strip the blabla.com off the name. So in the below example going to mycool.stuff.com/bla/bla my redirect will go to redirect.newdomain.com/mycool.stuff.com/more/stuff. I want to strip off "stuff.com" from HTTP::name to end with redirect.newdomain.com/mycool/more/stuff

Is this doable?
when HTTP_REQUEST {
if { [active_members [LB::server pool]] < 1 } {
    HTTP::redirect "https://redirect.newdomain.com/[HTTP::name]/more/stuff"
}

}

Thanks Joe

2 Replies

  • Hi Joe,

    for sure is this doable (almost everything is possible with F5 BIG-IP and iRules).

    Not sure where you have the [HTTP::name] from, as this is not a valid command, but your requirement should be solved with this iRule:

    when HTTP_REQUEST {
        if { [active_members [LB::server pool]] < 1 } {
            set subdomain [substr [HTTP::host] 0 "."]
            HTTP::redirect "https://redirect.newdomain.com/$subdomain/more/stuff"
        }
    }
    

    Please give it a try and let me know if this is fine for you.

    Ciao Stefan 🙂

  • Stefan, YOU ROCK! I think that is exactly what I need. I need to test it but right now I am getting an error that it is trying to go to the right page. Thanks Joe