Forum Discussion
matm_58717
Nimbostratus
Jul 11, 2013modify Request POST
Hello,
I have a web application where introduce user credential. When a client introduces your credentials, need intercept and inspect the POST, looking for the value to field "username".
I searched, but I don´t know if is possible to do this with iRules. ¿Have Someone an idea?
Thanks so much
3 Replies
- nitass
Employee
have you checked HTTP::collect? you can collect http payload and take whatever action you want.
HTTP::collect
https://devcentral.f5.com/wiki/irules.HTTP__collect.ashx - Kevin_Stewart
Employee
The username, I'm guessing, is in the POST payload. Example:
username=foo&password=bar
So something like this might work to extract the username from that data:when HTTP_REQUEST { if { [HTTP::method] equals "POST" } { HTTP::collect [HTTP::header Content-Length] } } when HTTP_REQUEST_DATA { if { [HTTP::payload] contains "username=" } { foreach x [split [HTTP::payload] "&"] { if { $x starts_with "username=" } { set username [lindex [split $x "="] 1] } } } } - Kevin_Stewart
Employee
The '&' above is of course just the ampersand sign.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects