Forum Discussion

goldi_247196's avatar
goldi_247196
Icon for Nimbostratus rankNimbostratus
Feb 17, 2016

how get response parameters

I need to load to f5(persist) one parameter from the response data I get from one of load balancer servers, How do I access the data received in response?

 

4 Replies

  • zeiss_63263's avatar
    zeiss_63263
    Historic F5 Account

    Hi,

     

    It sounds like you want an iRule to fire on a Response event and collect some part of the payload or headers (in HTTP for example). The iRule event and actions depend on the protocol and profiles in use. We couldn't advise anything more specific without knowing what your traffic is and where the data is in the payload you want to inspect.

     

    Michael.

     

    • goldi_247196's avatar
      goldi_247196
      Icon for Nimbostratus rankNimbostratus
      Hi Michael, We are trying to write a iRule for the BIG-IP universal persistence module. Our mission is to extract and persist from a HTTP response payload/body an application unique identifier (something like a seesionid for us). Then use it in a consecutive HTTP requests. Note, this unique identifier return in text/xml/soap-xml response formats and there is no cookie involve here. We're having problem to write the TCL code for the extraction of our custom unique identifier from the HTTP response payload/body. We have checked these manuals and did not find example for this kind of functionality: https://clouddocs.f5.com/api/irules/HTTP_RESPONSE.html https://clouddocs.f5.com/api/irules/HTTP__payload.html https://clouddocs.f5.com/api/irules/HTTP_RESPONSE_DATA.html https://clouddocs.f5.com/api/irules/HTTP__collect.html https://support.f5.com/kb/en-us/products/big-ip_ltm/manuals/product/ltm_configuration_guide_10_0_0/ltm_rules.html1197203 can you help? Thanks. goldi F5 iRule for UIE - Extracting a value from HTTP response payload/body
  • Hi, We are trying to write a iRule for the BIG-IP universal persistence module. Our mission is to extract and persist from a HTTP response payload/body an application unique identifier (something like a seesionid for us). Then use it in a consecutive HTTP requests. Note, this unique identifier return in text/xml/soap-xml response formats and there is no cookie involve here. We're having problem to write the TCL code for the extraction of our custom unique identifier from the HTTP response payload/body. We have checked these manuals and did not find example for this kind of functionality: https://clouddocs.f5.com/api/irules/HTTP_RESPONSE.html https://clouddocs.f5.com/api/irules/HTTP__payload.html https://clouddocs.f5.com/api/irules/HTTP_RESPONSE_DATA.html https://clouddocs.f5.com/api/irules/HTTP__collect.html https://support.f5.com/kb/en-us/products/big-ip_ltm/manuals/product/ltm_configuration_guide_10_0_0/ltm_rules.html1197203 can you help? Thanks. F5 iRule for UIE - Extracting a value from HTTP response payload/body
  • Try this irule:

    when HTTP_RESPONSE {
    
       Trigger collection for up to 1MB of data
      if {[HTTP::header exists "Content-Length"] && [HTTP::header "Content-Length"] <= 1048576}{
        set content_length [HTTP::header "Content-Length"]
      } else {
          set content_length 1048576
      }
       Check if $content_length is not set to 0
      if { ([HTTP::status] == 200) && ($content_length > 0)} {
        HTTP::collect $content_length
      }
    }
    
    when HTTP_RESPONSE_DATA {
         do stuff with the payload
        find the application unique identifier between  and  (5 is the length of  string)
        persist add uie [string trim [findstr [HTTP::payload] "" 5 ""]]
    }
    
    when HTTP_REQUEST {
        persist uie [string trim [findstr [HTTP::payload] "" 5 ""]]
    
    }