Forum Discussion

ryan_haig_15019's avatar
ryan_haig_15019
Icon for Nimbostratus rankNimbostratus
Apr 08, 2014

IRule URL and URI redirection

I would like to create a IRule to do the following:

 

Users goes to "http://m.test.com/avalanche/SymbolSearch/?pattern=/HELLOWORLD"

 

I would like to change that on the F5 to

 

"http://query.test.com/SymbolSearch/?pattern=/HELLOWORLD"

 

I would like to change the URL to "query.test.com" and remove the "/avalanche" but preserve the rest.

 

Thanks!!

 

1 Reply

  • You probably want something like this

     

     when HTTP_REQUEST {
        if { [string tolower  [HTTP::host]] equals "m.test.com" } {
            HTTP::respond Location "http://query.test.com[substr [HTTP::uri] 10 0]"
    
        }
    }
    • This code has not been tested.