Delete first entry from URL path using responder

Delete first entry from URL path using responder

book

Article ID: CTX633190

calendar_today

Updated On:

Description

Delete first entry from URL path using responder

Resolution

To delete the first entry from a URL using a responder, we can use the `HTTP.REQ.URL.PATH` expression to manipulate the URL.

However, please note that the Netscaler responder does not support direct URL manipulation.

We can create a responder policy that matches the URL pattern we want to change and then redirect to a new URL.

Here is an example of how we can do this:

  1. Create a responder action that redirects to the new URL:
  2. add responder action act_redirect redirect '"http://newurl.com" + HTTP.REQ.URL.PATH_AND_QUERY.AFTER_STR("/firstentry").HTTP_URL_SAFE
  3. Create a responder policy that matches the URL pattern: add responder policy pol_url 'HTTP.REQ.URL.PATH_AND_QUERY.BEFORE_STR("/").EQ("/firstentry")' act_redirect
  4. Bind the responder policy on your Virtual server:  bind lb vserver <Virutal server Name> -policyName pol_url -priority 100 
  5. In this example, the `HTTP.REQ.URL.PATH_AND_QUERY.AFTER_STR("/firstentry").HTTP_URL_SAFE` expression gets the part of the URL after "/firstentry",  and the `HTTP.REQ.URL.PATH_AND_QUERY.BEFORE_STR("/").EQ("/firstentry")` expression matches URLs that have "/firstentry" as the first entry in the path.

Problem Cause

Responder Policy

Issue/Introduction

In this example, the `HTTP.REQ.URL.PATH_AND_QUERY.AFTER_STR("/firstentry").HTTP_URL_SAFE` expression gets the part of the URL after "/firstentry",  and the `HTTP.REQ.URL.PATH_AND_QUERY.BEFORE_STR("/").EQ("/firstentry")` expression matches URLs that have "/firstentry" as the first entry in the path. Created a responder policy and bound to virtual server.

Additional Information

https://docs.netscaler.com/en-us/citrix-adc/current-release/appexpert/responder/binding-responder-policy.html