Forum Discussion

Aj2's avatar
Aj2
Icon for Altostratus rankAltostratus
Jan 08, 2024
Solved

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\...
  • Lucas_Thompson's avatar
    Jan 08, 2024

    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
    }