Forum Discussion
Need Help in iRule to Modify HTTP header parameter.
I need to Write iRule where I want to change the HTTP header parameter from
- sname to Sname
- uaccount to Uaccount
HTTP Header
POST /URI PATH/ HTTP/1.1\r\n
sname : BEVI9999\r\n
uaccount : \r\n
\r\n
is it correct iRule
when HTTP_REQUEST {
HTTP::header replace sname SName
HTTP::header replace uaccount UAccount
}
expected output
HTTP Header
POST /URI PATH/ HTTP/1.1\r\n
SName: BEVI9999\r\n
UAccount: \r\n
\r\n
Above iRule is correct for the requirement?
HTTP headers are not case sensitve in correctly implemented HTTP servers (see https://www.rfc-editor.org/rfc/rfc9110.html#name-field-names) , so the BIG-IP iRule command to handle them is also case insensitive (https://clouddocs.f5.com/api/irules/HTTP__header.html).
You'll have to first grab the header names (with any case), delete the headers (with any case), then re-add new headers (with your desired case). Something like this should work:
when HTTP_REQUEST {
set sname [HTTP::header value sname]
set uaccount [HTTP::header value uaccount]
HTTP::header remove sname
HTTP::header remove uaccount
HTTP::header replace SName $sname
HTTP::header replace UAccount $uaccount
}
- Lucas_ThompsonEmployee
HTTP headers are not case sensitve in correctly implemented HTTP servers (see https://www.rfc-editor.org/rfc/rfc9110.html#name-field-names) , so the BIG-IP iRule command to handle them is also case insensitive (https://clouddocs.f5.com/api/irules/HTTP__header.html).
You'll have to first grab the header names (with any case), delete the headers (with any case), then re-add new headers (with your desired case). Something like this should work:
when HTTP_REQUEST {
set sname [HTTP::header value sname]
set uaccount [HTTP::header value uaccount]
HTTP::header remove sname
HTTP::header remove uaccount
HTTP::header replace SName $sname
HTTP::header replace UAccount $uaccount
} - zamroni777Nacreous
instead of irules scripting, you can use gui based local traffic policy
https://community.f5.com/t5/technical-articles/to-irule-or-not-to-irule-introduction-to-local-traffic-policies/ta-p/279536
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