Forum Discussion

BharatSharda's avatar
BharatSharda
Icon for Altostratus rankAltostratus
Apr 08, 2021

Insert text to HTTP header via iRule event during APM execution

Hi Community Members, We are trying to insert some text to HTTP header through an iRule which will check for ACCESS_POLICY_AGENT_EVENT generated by via iRule event during an APM checking. Event "...
  • spalande's avatar
    Apr 14, 2021

    HTTP_REQUEST_SEND is also one of the event can be used to send the APM variable.

    https://support.f5.com/csp/article/K74392192

    so worth trying below. modify as needed.

    when ACCESS_POLICY_AGENT_EVENT {
        if { [ACCESS::policy agent_id] eq "event_1" } {
            ACCESS::session data set session.custom.header "value"
            set header [ACCESS::session data get "session.custom.header"]
        }
     }
     
     when HTTP_REQUEST_SEND  {    
        clientside {
        if {[info exists header]}{ 
    	HTTP::header insert "headername" $header
        } else {
    	 return
    	}
       }	
     }