Forum Discussion

Steve_Brown_882's avatar
Steve_Brown_882
Historic F5 Account
Jul 07, 2009

transforming a portion of the URI

I am wondering if anyone has any ideas on how I might complete the following task

 

Basically I need to search for a URI that contains "/something..." and change it to "/anotherURI...".

 

 

An example www.site.com/abc/newpage/... should become www.site.com/def/newpage/... when forwarded to the backend.

 

 

I am thinking I might be able to use a stream profile, but this seems like it might not be the best options since I know I am only looking at the HTTP::uri.

2 Replies

  • Steve_Brown_882's avatar
    Steve_Brown_882
    Historic F5 Account
    Ok sorry for this post, I should have searched first. I found a solution for me that worked in this blog post. http://devcentral.f5.com/weblogs/joe/archive/2005/07/27/ModifyingUriWithoutRedirect.aspx

     

     

    THis only worked because I was able to confirm the uri would always start a certain way. Any ideas if this had not been the case?
  • There are quite a few string manipulation commands in TCL and some custom ones in iRules that you could use for scenarios like that:

     

     

    getfield

     

    split + lindex

     

    string first + string range

     

    scan

     

     

    You can check the iRules wiki and the TCL man pages for details/examples:

     

     

    http://devcentral.f5.com/wiki/default.aspx/iRules.Functions

     

     

    http://www.tcl.tk/man/tcl8.4/TclCmd/contents.htm

     

     

    Aaron