Forum Discussion

mburnham_59608's avatar
mburnham_59608
Icon for Nimbostratus rankNimbostratus
Aug 07, 2011

can't rewrite uri

Hi all,

I'm trying to do something which I think is supposed to be very basic, but is failing:

when HTTP_REQUEST { 

      if { [HTTP::version] eq "1.1" } { 
           if { [HTTP::header is_keepalive] } { 
              HTTP::header replace "Connection" "Keep-Alive" 
           } 
           HTTP::version "1.0" 
       } 
      
       if {[HTTP::uri] starts_with "/forms/"}{
            set new_uri /f5-w-687474703a2f2f6562626f736465762e6d732e636f6d3a37373832$$[HTTP::uri]

            HTTP::uri  $new_uri 
           log local0. [HTTP::uri]     
        }

}
Basically, the uri is never changed - I've verified on the back end. I read something about the uri getting cached - is this something to check? Can I purge the cache?

Thanks much,

Mark

2 Replies

  • Hi Mark,

     

    Try this

     

    HTTP::uri /f5-w-687474703a2f2f6562626f736465762e6d732e636f6d3a37373832$$[HTTP::uri]

     

     

    Bhattman

     

     

     

     

  • HTTP::uri should be working to rewrite the URI. You can log the updated value by using a later priority HTTP_REQUEST event:

    when HTTP_REQUEST { 
       if { [HTTP::version] eq "1.1" } { 
          if { [HTTP::header is_keepalive] } { 
             HTTP::header replace "Connection" "Keep-Alive" 
          } 
          HTTP::version "1.0" 
       } 
       if {[HTTP::uri] starts_with "/forms/"}{
          HTTP::uri "/f5-w-687474703a2f2f6562626f736465762e6d732e636f6d3a37373832$$[HTTP::uri]"
       }
    }
    when HTTP_REQUEST priority 501 {
       log local0. [HTTP::uri]
    }
    

    Aaron