Forum Discussion
Does http::payload replace work on the http request?
Hi,
All the payload replace examples I have seen have to do with outbound traffic. (Eg: mask credit card numbers).
Does the payload replace functionality also work for inbound traffic?
Does anyone know of any examples?
Thanks TF
5 Replies
i dont believe so, there is not actual http payload in a http request, just the request and the headers i believe. so there is no need to change something here right?
do you have a specific situation you want to tackle?
- Andre_Nurwono
Employee
HTTP POSTs contain HTTP payloads, although in most use cases it's the HTTP headers that most customers want replaced.
- Kevin_Stewart
Employee
You can replace ANY HTTP request payload in the same manner as response payload.
HTTP::payload replace 0 [HTTP::header Content-Length] "blah-blah-blah" - hoolio
Cirrostratus
As Kevin said, this certainly is possible: Here's an example from the HTTP::collect wiki page. You can also check the HTTP::payload wiki page for more info on doing the payload replacement: https://devcentral.f5.com/wiki/iRules.http__collect.ashx https://devcentral.f5.com/wiki/iRules.http__payload.ashx
From https://devcentral.f5.com/wiki/iRules.http__collect.ashx Collect a request payload when HTTP_REQUEST { if {[HTTP::method] eq "POST"}{ Trigger collection for up to 1MB of data if {[HTTP::header "Content-Length"] ne "" && [HTTP::header "Content-Length"] <= 1048576}{ set content_length [HTTP::header "Content-Length"] } else { set content_length 1048576 } Check if $content_length is not set to 0 if { $content_length > 0} { HTTP::collect $content_length } } } when HTTP_REQUEST_DATA { do stuff with the payload set payload [HTTP::payload] } - Thinkfast_12947
Nimbostratus
This is great. Thank you.
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