Forum Discussion

Shyam_Shukla's avatar
Shyam_Shukla
Icon for Nimbostratus rankNimbostratus
Feb 14, 2020

Replace mutiple forward slash with one

Hello All,

 

I need to check if [HTTP::path] contains more than one forward slash (/) then replace all of them with single forward slash.

For e.g., if [HTTP::path] value comes as //abcd//xyz//abcd then it should get replaced with /abcd/xyz/abcd.

 

Thanks,

Shyam

 

 

 

3 Replies

  • Hi Shyam Shukla,

     

    You can use a Local Traffic Policies to do this.

  • Thank you for sharing the details.

    I am wondering how it would handle if more than 2 forward slash are found in URI , for e.g. ////abcd//xyz///abcd as it would just check for 2 forward slashes and in the request URI there could be 2, 3 ...n number of forward slashes? Can regex be put in condition block of Local Traffic Policies?

     

    Thanks,

    Shyam

  • I think that the policy only check for 2 forward slashes and as far i kown, regex cannot be used in Local Traffic Policies.