Forum Discussion
Mattias_Holmber
Nimbostratus
Dec 09, 2008How do I get username from a POST
I have an irule that I want to do some debugging with.
So, basically I just want to write out the POST variable "username" to log.
rule get_user_id {
when HTTP_RE...
Nicolas_Menant
Employee
Dec 09, 2008Hi,
You won't be able to retrieve data like this if it's a POST method. POST means you have to check the payload, to do this you'll have to use HTTP::collect, HTTP::payload, when HTTP_RESPONSE and when HTTP_RESPONSE_DATA
when HTTP_REQUEST {
if {[HTTP::uri] contains "login"} {
HTTP::collect
}
}
when HTTP_REQUEST_DATA {
set parameter_vals [split [HTTP::payload] "&"]
Break out the POST data for username
for {set i 0} {$i < [llength $namevals]} {incr i} {
set params [split [lindex $namevals $i] "="]
if { [lindex $params 0] equals "username" } {
set username [lindex $params 1]
}
}
}
I didn't tested it but should be close
HTH
N.
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
