Forum Discussion
Insert text to HTTP header via iRule event during APM execution
- 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 } } }
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
}
}
}
- BharatShardaApr 16, 2021Altostratus
when ACCESS_POLICY_AGENT_EVENT { if { [ACCESS::policy agent_id] eq "event_1" } { ACCESS::session data set session.custom.header "1" } else { ACCESS::session data set session.custom.header "0" } when HTTP_REQUEST_SEND { clientside { set header [ACCESS::session data get "session.custom.header"] if { $header }{ HTTP::header insert "headername" $header } else { return } } }
Hi Sanjay,
This worked for my case with a little tweak, had to set the $header again in HTTP_REQUEST_SEND to proceed with the HTTP header insertion. Also the log local0. helped a lot. Thank you for your inputs in here. Cheers.
I traced the HTTP headers by printing then in ltm logs referring to https://support.f5.com/csp/article/K42210592
when HTTP_REQUEST { foreach aHeader [HTTP::header names] { log local0. "HTTP Request Headers: $aHeader: [HTTP::header value $aHeader]" } }
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com