Forum Discussion

Dunleap_21354's avatar
Dunleap_21354
Icon for Nimbostratus rankNimbostratus
Apr 10, 2008

changing URI path

So I need to write a rule that will "see" the path /citrix/pnagent/confg.xml and replace it with /pnagent/config.xml removing the citrix part.

 

My first stab doesn't appear to be working, Any ideas on what I am missing ???

 

 

when HTTP_REQUEST {

 

if { [HTTP::path] equals "/citrix/pnagent/conf.xml" } {

 

HTTP::header replace "path" "/pnagent/config.xml"

 

}

 

}

4 Replies

  • I created a stream profile, giving it a name.

     

    a source=citrix/pnagent/config.xml

     

    a target =pnagent/config.xml

     

    and added it to the VS properties under stream profile.

     

     

    In checking with tcpdump though I am still seeing /citrix/pnagent/config.xml ?

     

     

    14:05:40.836608 10.2.1.200.1092 > 159.140.175.195.http: P 1:224(223) ack 1 win 4380 (DF)

     

    0x0000 4500 0107 5ea2 4000 ff06 c134 0a02 01c8 E...^.@....4....

     

    0x0010 9f8c afc3 0444 0050 a287 2039 1d62 4807 .....D.P...9.bH.

     

    0x0020 5018 111c e0d5 0000 4745 5420 2f63 6974 P.......GET./cit

     

    0x0030 7269 782f 706e 6167 656e 742f 636f 6e66 rix/pnagent/conf

     

    0x0040 6967 2e78 6d6c 2048 5454 502f 312e 310d ig.xml.HTTP/1.1.

     

    0x0050 0a41 6363 6570 743a 202a 2f2a 0d0a 4163 .Accept:.*/*..Ac

     

    0x0060 6365 7074 2d4c 616e 6775 6167 653a 2065 cept-Language:.e

     

    0x0070 6e2d n-
  • Are you doing the trace between the bigip and the client or between the bigip and the server ?

     

     

    Otherwise to replace the path you can do the following:

     

     

    when HTTP_REQUEST {

     

    if { [HTTP::path] equals "/citrix/pnagent/conf.xml" } {

     

    HTTP::path "/pnagent/config.xml"

     

    }

     

    }

     

     

    syntax here : Click here

     

     

    But Colin is right (as usual i would say :p), won't you need to rewrite the url in the response too ? if that's the case a stream profile is the best method to achieve this
  • This packet was between the LTM and the the IIS server. The information on Stream profile is pretty thin in the F5_LTM_Guide.
  • The stream profile/filter only operates against the payload. So if you've added an HTTP profile to the VIP, and want to modify the path in the URI (part of the headers--not the payload), you should use nmenant's example of HTTP::path.

    If you need to rewrite the request and/or response payload, I'd suggest adding a blank stream profile to the VIP and an iRule to configure the stream filter. Here is an example of replacing a string in the response content:

    http://devcentral.f5.com/wiki/default.aspx/iRules/stream__expression

    
    when HTTP_RESPONSE {
        Disable the stream filter by default
       STREAM::disable
        Check if response type is text
       if {[HTTP::header value Content-Type] contains "text"}{
           Replace IE with Apache, Windows with Linux
          STREAM::expression "@IE@Apache@ @Windows@Linux@"
           Enable the stream filter for this response only
          STREAM::enable
       }
    }

    You can find more information on the stream profile and related STREAM:: commands on AskF5 and the iRules wiki:

    SOL8115: Overview of the Stream profile:

    https://support.f5.com/kb/en-us/solutions/public/8000/100/sol8115.html?sr=636220

    iRules STREAM wiki page:

    http://devcentral.f5.com/wiki/default.aspx/iRules/stream

    Aaron