Forum Discussion

Jonathan_124522's avatar
Jonathan_124522
Icon for Nimbostratus rankNimbostratus
Sep 17, 2015

Capture value between slashes in uri

I need an irule to capture the characters between slashes in a uri. For example, in the uri www.example.com/test1/test2/test3/ i want to set a variable value to what ever is between the second and third slashes which in this case would be test2.

 

1 Reply

  • Hi, try this

    cheers

    when HTTP_REQUEST {
      set a [getfield [HTTP::path] "/" 3]
      log local0. "value = $a"
    }
    
    
    $curl http://10.12.12.145/test1/test2/test3/
    config  info tmm1[17994]: Rule /Common/getfield : value = test2