Forum Discussion

Shahbaz_Mokaria's avatar
Shahbaz_Mokaria
Icon for Nimbostratus rankNimbostratus
Oct 17, 2006

remove part of hearder

I am trying to change the URL from http://abc.cde.com/xyz/inventory.do?tt

 

to

 

http://abc.cde.com/inventory.do?tt

 

 

 

 

 

I tried following rule but it changed the whole url to real server behind F5.

 

 

when HTTP_REQUEST {

 

set uri [HTTP::uri]

 

if { $uri contains "/stores" } {

 

HTTP::header sanitize "/stores"

 

}

 

}

 

 

Any help or hint will be appriciated.

 

Thanks.

 

2 Replies

  • Hello,

    It sounds like you want to remove a directory from the URI in a client request before the request is sent to the pool.

    You can use HTTP::uri to set the URI and a string function to manipulate the original requested URI.

    Here is a rough example:

    
    when HTTP_REQUEST {
       set uri [string tolower [HTTP::uri]]
       if { $uri starts_with "/stores" }{
          HTTP::uri [string map -nocase {"/stores" ""} $uri]
       }
    }   

    I think string map should accept "" as the replacement string. If it doesn't you might want to use another string function to remove the first seven characters of the URI instead of string map.

    This post has some background info and additional options (Click here)

    Hope this gets you started.

    Aaron