Forum Discussion

fletcher_61042's avatar
fletcher_61042
Icon for Nimbostratus rankNimbostratus
Aug 17, 2007

need a simple rule

I have never worked on big ip b4 and I am not able to write scripts so good. I got tossed into managing the BIG ips here and i am looking forward to the challenge.

 

 

I need a very simple rule to redirect traffic from one website to another.

 

 

Is this how I should do it?

 

 

when HTTP_REQUEST {

 

if { [HTTP::host] equals "www.testa.com" } {

 

use pool testa

 

}

 

else {

 

HTTP::redirect "http://testb.com[HTTP::uri]"

 

}

 

}

 

 

Thanks for your help and I am sure you will see me here often.
  • Deb_Allen_18's avatar
    Deb_Allen_18
    Historic F5 Account
    Looks good, although you might want to make your comparison case-insensitive:
    
    when HTTP_REQUEST {
      if {[string tolower [HTTP::host]] equals www.testa.com} {
        use pool testa
      } else {
        HTTP::redirect http://testb.com[HTTP::uri]
      }
    }

    /deb