Jump to content
Welcome to our new Citrix community!

Conver Redirect F5 Irule


yusuf rifqi

Recommended Posts

Hi , I'm having issue converting this f5 irule to a Citrix Netscaler policy (Rewrite/Responder) :

 

 

when http_request{
 if {[string tolower [HTTP::host]] equals "abcd.com" && [HTTP::uri] equals {/}}{
  HTTP::redirect "http://abcd.com/myapp"
 }elseif {[string tolower [HTTP::host]] equals "qwertyuiop.com" && [HTTP::uri] equals {/}}{
  HTTP::redirect "http://qwertyuiop.com/app"
 }elseif {[string tolower [HTTP::host]] equals "asdf.com" && [HTTP::uri] equals {/}}{
  HTTP::redirect "http://asdf.com/app1"
 }
}

 

 

So in Citrix I guess it will be 1 Virtual Server with 3 different domain.

Should I create a 3 different policy or just 1 policy?

 

Thank You.

Link to comment
Share on other sites

You have three different redirects, so you need three separate redirect actions/policies:

NOTE: the below are based on the host being equal to the domain specified (no need for www.abcd.com) for example.  I made it case-insenstive, but you can also use to_lower() operators for the same result.  And the exact path match on "/".

 

# create policies/actions based on above

add responder action rs_act_sendto_abcd redirect '"http://abcd.com/myapp"'

add responder policy rs_pol_sendto_abcd 'http.req.header("host").set_text_mode(ignorecase).eq("abcd.com") && http.req.url.path.eq ("/")'

 

add responder action rs_act_sendto_qwerty redirect '"http://qwertyuiop.com/app"'

add responder policy rs_pol_sendto_qwerty 'http.req.header("host").set_text_mode(ignorecase).eq("qwertyuiop.com") && http.req.url.path.eq ("/")'

 

add responder action rs_act_sendto_asdf redirect '"http://asdf.com/app1"'

add responder policy rs_pol_sendto_asdf 'http.req.header("host").set_text_mode(ignorecase).eq("asdf.com") && http.req.url.path.eq ("/")'

 

# bind to lb vserver, if all fqdns resolve to the same vip (content switching could also be used if appropriate)

bind lb vserver lb_vsrv_demo -policyname rs_pol_sendto_abcd -priority  100

bind lb vserver lb_vsrv_demo -policyname rs_pol_sendto_asdf -priority  110

bind lb vserver lb_vsrv_demo -policyname rs_pol_sendto_qwerty -priority  120

 

 

 

 

 

  • Like 1
Link to comment
Share on other sites

On 7/10/2020 at 7:51 AM, Rhonda Rowland1709152125 said:

You have three different redirects, so you need three separate redirect actions/policies:

NOTE: the below are based on the host being equal to the domain specified (no need for www.abcd.com) for example.  I made it case-insenstive, but you can also use to_lower() operators for the same result.  And the exact path match on "/".

 

# create policies/actions based on above

add responder action rs_act_sendto_abcd redirect '"http://abcd.com/myapp"'

add responder policy rs_pol_sendto_abcd 'http.req.header("host").set_text_mode(ignorecase).eq("abcd.com") && http.req.url.path.eq ("/")'

 

add responder action rs_act_sendto_qwerty redirect '"http://qwertyuiop.com/app"'

add responder policy rs_pol_sendto_qwerty 'http.req.header("host").set_text_mode(ignorecase).eq("qwertyuiop.com") && http.req.url.path.eq ("/")'

 

add responder action rs_act_sendto_asdf redirect '"http://asdf.com/app1"'

add responder policy rs_pol_sendto_asdf 'http.req.header("host").set_text_mode(ignorecase).eq("asdf.com") && http.req.url.path.eq ("/")'

 

# bind to lb vserver, if all fqdns resolve to the same vip (content switching could also be used if appropriate)

bind lb vserver lb_vsrv_demo -policyname rs_pol_sendto_abcd -priority  100

bind lb vserver lb_vsrv_demo -policyname rs_pol_sendto_asdf -priority  110

bind lb vserver lb_vsrv_demo -policyname rs_pol_sendto_qwerty -priority  120

 

 

 

 

 

Hi Rhonda Rowland,

your answer is very helpful.

 

Thank You so much!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...