Forum Discussion

pbelamge_70866's avatar
Icon for Nimbostratus rankNimbostratus
May 20, 2011

URL Re-Writing help needed

Hello All,



I am new to iRule and would like to know how can I solve my below mentioned problem



I have f5 switch and want this switch to filter incoming http requests based on domain / path and etc. After filtering this, it should send ONLY the path of the uri to the pool. Not absolute url



For. e.g.



If incoming request is "", then f5 switch should send the uri to the pool as "/path/object.html?args=value"







2 Replies

  • You cannot just send the URI. That would be out of context on an HTTP Request.



    You could replace the [HTTP::host] value with another value if you like. You could use a stream profile, string map replace, etc.
  • Is the client sending an absolute URL in the URI and the web app can't handle this? If so, do you want to remove the protocol and host from the URI? If that's the case, you should be able to use something like this:

    when HTTP_REQUEST {
     Check for an absolute URI
    if {not ([HTTP::uri] starts_with "/")}{
    if {[scan $abs_uri {%[^/]//%[^/]%s} proto host uri] == 3}{
     Log and set the URI to a local URI
    log local0. "\$proto: $proto, \$host: $host, \$uri: $uri"
    HTTP::uri $uri