Jump to content
Welcome to our new Citrix community!

ADC Policy regex (assistance)


Recommended Posts

Dear Community,

 

I want to configure a redirect policy

 

Example: 

 

Old Page: 

https://abc.com/Alpha/Beta/xyz
https://abc.com/Alpha/Beta/csg
https://abc.com/Alpha/Beta/123
https://abc.com/Alpha/Beta/434

 

New Page:
https://def.com/Delta/Gamma/Zeta/Alpha/Beta/xyz
https://def.com/Delta/Gamma/Zeta/Alpha/Beta/csg
https://def.com/Delta/Gamma/Zeta/Alpha/Beta/123
https://def.com/Delta/Gamma/Zeta/Alpha/Beta/434

 

I tryed with this expression: 

 

Responder Policy:

HTTP.REQ.HEADER("Host").CONTAINS("abc.com") && HTTP.REQ.URL.EQ("/Alpha/Beta/")

 

Redirect:

"https://" + "https://def.com/Delta/Gamma/Zeta" + HTTP.REQ.URL.PATH_AND_QUERY

 

Any assistance you can provide would be greatly appreciated. Thanks!

Link to comment
Share on other sites

For the redirect policy expression: change this

1 hour ago, Ahinth Akilajeevan said:

HTTP.REQ.HEADER("Host").CONTAINS("abc.com") && HTTP.REQ.URL.EQ("/Alpha/Beta/")

 

The problem is EQ("") is a complete string match and you are only matching on a partial path: switch to this instead:

HTTP.REQ.HEADER("Host").CONTAINS("abc.com") && HTTP.REQ.URL.PATH.SET_TEXT_MODE(Ignorecase).STARTSWITH("/Alpha/Beta/")

(its either startswith("") or starts_with("") if syntax error).

 

For your Redirect Action:

change this:

"https://" + "https://def.com/Delta/Gamma/Zeta" + HTTP.REQ.URL.PATH_AND_QUERY

to this:

"https://def.com/Delta/Gamma/Zeta" + http.req.url.path_and_query

You would have had an incorrectly parsed URL

  • Like 1
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...