Forum Discussion

fusky_116783's avatar
fusky_116783
Icon for Nimbostratus rankNimbostratus
May 08, 2013

Remove or change the URI doesn't work

Hi.

 

I want to change the original URI, but it doesn't work:

 

HTTP::uri "PPPPP"

 

log local0. "New Uri-->[HTTP::uri]<--"

 

If I watch the log, i can see --> : New Uri-->/original_uri<--

 

 

Why?

 

Colud you please help me?

 

Thanks in advance

 

 

5 Replies

  • Can you provide some context please, such as which event you are doing this in, or perhaps the entire rule?
  • There's potentially a few things going on here. In most BIG-IP versions, changing the uri value using the [HTTP::uri] "something" syntax will change the flow context, but will not actually change [HTTP::uri] from its original value. Strange I know. So changing the uri within the event should cause the uri to change in the context of the event, but you won't be able to see those changes by logging the value of [HTTP::uri]. Also, a uri will always start with "/", so by changing it to "PPPP" without a leading "/" would likely break the request.
  • Well.

     

     

    I post the context:

     

     

    when HTTP_REQUEST {

     

    if {[HTTP::uri] eq "/brasil"}

     

    {

     

    HTTP::uri "/PPP"

     

    log local0. "Nueva Uri-->[HTTP::uri]<--"

     

    pool pool_xxxx

     

     

    }

     

  • In versions less that 11.0, most of the HTTP:: command values are cached within the same iRule event, so they won't show the changed values. You can change the value, but the command itself will return the cached original. If you're on a version that is 11.0 or below there's a very good chance that your log statement is printing the original URI ("/brasil"), but that shouldn't affect the functionality that you're trying to produce. Otherwise, if the iRule isn't working as expected, regardless of the log statement, add some additional logging to see what is and isn't happening:

    
    when HTTP_REQUEST {
        log local0. "Incoming URI = [HTTP::uri]"
        if { [HTTP::uri] eq "/brasil" } {
            log local0. "Caught /brasil URI"
            HTTP::uri "/PPP"
            pool pool_xxxx
        }
    }
    
  • Hi.

     

     

    Yeah. My version is 9.1.1, and the data was cached.

     

    It's ok.

     

     

    Thank you very much!!!!