Jump to content
Updated Privacy Statement

Help with rewrite policy


Recommended Posts

Hello

I'm rookie in netscaler configuration. We need to rewrite a URL like this:

https://servername.domain.com/anytext/anytext2 to https://servername.domain.com/anytext2 and send this to the backend service

I know that we need to configure the a rewrite action and rewrite policy and then bind to the lbvs.

Did you how to configure this rewrite policy? I tried but I can make it works.

Would be very appreciated if someone can tell us how to configure action and policy

Regards

 

Link to comment
Share on other sites

reviewing this note:

https://support.citrix.com/article/CTX221363/remove-beginning-section-of-url-using-rewrite-policy

I try this:

add rewrite action test replace HTTP.REQ.URL "\"/\"+HTTP.REQ.URL.PATH_AND_QUERY.STRIP_START_CHARS(\"/start_of_path/\")" -bypassSafetyCheck YES

but we are receiving this error:

Expression syntax error [ath/\")" -^bypassSafe, Offset 76]

Any ideas?

Reagrds

 

Link to comment
Share on other sites

To change https://servername.domain.com/anytext/anytext2 to https://servername.domain.com/anytext2

you will use the URL Transformation feature which is bound as a Transform.

add transform profile demo_urlt_profile
add transform action demo_urlt_profile demo_urlt_profile 100
set transform action demo_urlt_profile -priority 100 -reqUrlFrom "http(s?)://servername.domain.com/anytext/(.*)" -reqUrlInto "http$1://servername.domain.com/$2" -resUrlFrom "http(s?)://servername.domain.com/(.*)" -resUrlInto "http$1://servername.domain.com/anytext/$2" 

add transform policy demo_urlt_profile true demo_urlt_profile
bind lb vserver <vserver> -policyName demo_urlt_profile 

 

  • Like 1
Link to comment
Share on other sites

anytext is a literal.  To allow any string in the first folder, you can use regex: http(s?)://servername.domain.com/.+?/(.*)

This will work for the request (reqUrlFrom) processing but it will not work in the response (resUrlInto) processing. 

The resUrlFrom looks at server supplied redirects and hardcoded links in the page in order to change it back into something the client will use (resUrlInto).   This, and the ability to have more than one transform action are what makes URL-T powerful.  

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