For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

ben_svobodny_18's avatar
ben_svobodny_18
Icon for Nimbostratus rankNimbostratus
Oct 19, 2015

help with http::path

Hello i am trying to add logic in to account for different branches of testing in my irule.

 

currently we adjust the http:path to a particular value

 

set apiPathStage "apiproxy/apiproxy.aspx"

 

 

HTTP::path $apiPathStage

 

example request may be http://1.2.3.4/interface.asp?Command=testcommand

 

converts to http://1.2.3.4/apiproxy/apiproxy.aspx?command=testcommand

 

this works great.

 

going forward the developers want to be able to add in additional branches to the path such as:

 

http://1.2.3.4/test/interface.asp?Command=testcommand

 

http://1.2.3.4/stage/interface.asp?Command=testcommand

 

http://1.2.3.4/dev/interface.asp?Command=testcommand

 

I am looking for a way to take the first part of the entered path and insert it before the applied path value.

 

so that the 3 examples above would generate:

 

http://1.2.3.4/test/apiproxy/apiproxy.aspx?command=testcommand

 

http://1.2.3.4/stage/apiproxy/apiproxy.aspx?command=testcommand

 

http://1.2.3.4/dev/apiproxy/apiproxy.aspx?command=testcommand

 

any help would be appreciated.

 

thanks,

 

Ben

 

1 Reply

  • If you are just trying to map 'interface.asp' to 'apiproxy/apiproxy.aspx' in the HTTP path use the following:

    HTTP::path [ string map { "interface.asp" "apiproxy/apiproxy.aspx" } [string tolower HTTP::path] ]
    

    This takes the HTTP::path value (converted to lowercase) and does a search for "interface.asp" and replaces it with "apiproxy/apiproxy.aspx" then passes it back as the HTTP::path.