Forum Discussion

Shanmuga_Sundar's avatar
Shanmuga_Sundar
Icon for Nimbostratus rankNimbostratus
Nov 18, 2019

iRules - How to send HTTP Response to a HTTP Pool by HSL

We want to send both request and response to a HTTP pool via HSL.

 

We could able to send request succesfully by below iRule

 

when CLIENT_ACCEPTED {       

               set hsl_test [HSL::open -proto TCP -pool clone_test_pool]  

    }

when HTTP_REQUEST_DATA {

 set request_cmd "HTTP::request"

 when HTTP_REQUEST_DATA {

 HSL::send $hsl_test "[eval $request_cmd][HTTP::payload]" 

}

 

But we are not able to send HTTP Response in similar fashion like below.

 

when HTTP_RESPONSE {

 set response_cmd "HTTP::response"

 when HTTP_REQUEST_DATA {

 HSL::send $hsl_test "[eval $response_cmd][HTTP::payload]" 

}

2 Replies

  • You can accomplish this task more efficiently without an iRule by using request logging profiles.

    Request logging profiles can be configured to log both the request and response,

    https://techdocs.f5.com/kb/en-us/products/big-ip_ltm/manuals/product/bigip-external-monitoring-implementations-12-0-0/3.html.

     

    set response_cmd "HTTP::response" <--- HTTP::response isn't a valid command. There is no equivalent to HTTP::request for response.

    when HTTP_REQUEST_DATA <--- This should be the HTTP_RESPONSE_DATA event. https://clouddocs.f5.com/api/irules/HTTP_RESPONSE_DATA.html

     

    I'd encourage you to pursue the request log profile route first unless there is some specific task it cannot complete within the scope of your requirements.

     

    Best,

    Andrew

    • Shanmuga_Sundar's avatar
      Shanmuga_Sundar
      Icon for Nimbostratus rankNimbostratus

      Our use case is we have a Analytic server to analyze both HTTP Request and Response.

      We need to clone the traffic to it for some HTTP endpoints.

       

      Currently we cannot tweak existing logging configuration due some restrictions internal to the project . Is there any way we can do this through iRule?.

       

      Thanks for your support.