Forum Discussion

Steven_Ruby_872's avatar
Steven_Ruby_872
Icon for Nimbostratus rankNimbostratus
Jan 13, 2006

http url redirect

after searching through the forum and trying a couple of diff iterations of redirect iRules.

 

 

i need to redirect requests for http://server/dir to http://new.server/dir

 

 

currently i have the following which doesnt seem to work.

 

 

 

I HAVE FIGURED IT OUT, the following works

 

 

rule url_redirect

 

when HTTP_REQUEST {

 

if { [HTTP::uri] contains "wnidata2"} {

 

log local0. "URL is [HTTP::uri]"

 

HTTP::redirect "http://someurl[HTTP::uri]"

 

HTTP::redirect "http://www.google.com"

 

}

 

}

 

 

thanks

 

-sr
  • Colin_Walker_12's avatar
    Colin_Walker_12
    Historic F5 Account
    When you say this doesn't work, what exactly do you mean? The rule appears to be correct. It's a pretty standard redirect rule that looks like:

    
    when HTTP_REQUEST {
      if {[string tolower [HTTP::uri] ] contains "wnidata2"} {
        log local0. "URL is [HTTP::uri]"
        HTTP::redirect "http://fms.wni.com[HTTP::uri]"
      }
    }

    -Colin
  • One possible thing that sticks out is if this iRule is configured on a virtual that is the address for "fms.wni.com" then this will cause an infinite loop.
  • JOe,

     

     

    yeah i found that out the hard way, i just created a new pool with the "other" servers and pointed it at that.

     

     

    thanks for the reply

     

     

    sr