Forum Discussion
iRule: How to grab the Line-base text data and replace with desired value...
This question is a bit like the following:
https://devcentral.f5.com/questions/how-to-check-if-response-contains-a-specific-string-using-irules
And perhaps this modified iRule would do the trick:
when HTTP_REQUEST {
if { [HTTP::method] equal "POST" } {
catch { HTTP::collect [HTTP::header Content-Length] }
}
}
when HTTP_REQUEST_DATA {
if { [HTTP::payload] contains "emei" } {
HTTP::header insert P "R"
}
}
Without more specifics, the above very simply inserts a header into the ingress request (to the server) based on a POST request containing "emei". Not sure if the header has to be based on the value of the emei data, but you could easily parse that out if needed. The HTTP::request command will only return the raw HTTP headers, so you'd never see the payload of a POST using that. To get to the payload (reliably), you need to collect and buffer the data using the HTTP::collect command and subsequent HTTP_REQUEST_DATA event.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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