Forum Discussion

SY's avatar
SY
Icon for Nimbostratus rankNimbostratus
May 26, 2021

Help with url redirect

I'm very new to F5 platform and need to work out how to do a url redirect for multiple backend servers

i am assuming creating an irule would be the best way for this solution ?

 

we currently have a working solution via F5 APM for remote users to connect to a public address / url

remote users connect to a url for example https://trx.company.com and are successfully authenticated and forwarded on to a back end server

 

there is now a requirement that if users add a specific suffix to the url they connect to they will be redirected to different back end servers

 

for example

 

https://trx.company.com/abc will be redirected to a different backend server

and

https://trx.company.com/def will be redirected to different backend server

 

is creating an irule the best method to provide this solution ?

 

and any help with the format of an appropriate irule would be much appreciated

 

thanks in advance

 

 

 

 

  • Hi SY,

    You can use iRule or LTM Policy.

    to pool:

    when HTTP_REQUEST {
    	if { [HTTP::host] equals "trx.company.com" } {
    		switch -glob [HTTP::uri] {
    			"/abc*" { pool pool-abc }
    			"/def*" { pool pool-def }
    		}
    	}
    }

    to node:

    when HTTP_REQUEST {
    	if { [HTTP::host] equals "trx.company.com" } {
    		switch -glob [HTTP::uri] {
    			"/abc*" { node 10.11.12.13 443 }
    			"/def*" { node 10.12.14.16 443 }
    		}
    	}
    }
  • SY's avatar
    SY
    Icon for Nimbostratus rankNimbostratus

     

    Thanks for your reply

    i tried the second irule you suggested using node ip addresses and this did not work

    users are only ever forwarded to the backend server associated to the original url without the extension