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 Parked at Loopia. I want to strip off “stuff.com” from HTTP::name to end with Parked at Loopia

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

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 :slightly_smiling_face:

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