Hi Pete,
Thank you for your answer.
I tested your iRule.
When using postman to post the JSON,
the postman keeps saying “Sending Request” until I hit the cancel button
I have added 2 logs line:
when HTTP_REQUEST {
if { [HTTP::method] == "POST"} {
log local0. ">>> Method is POST<<<"
HTTP::collect
log local0. ">>> HTTP Collected<<<"
}
}
when HTTP_REQUEST_DATA {
set token [ regexp -inline -- {"token": "(.+)"} [HTTP::payload] ]
log local0.debug "Token: $token"
}
In the ltm log I see:
Apr 29 08:27:43 bigip1 info tmm2[18399]: Rule /Common/test-iRule <HTTP_REQUEST>: >>> Method is POST<<<
Apr 29 08:27:43 bigip1 info tmm2[18399]: Rule /Common/test-iRule <HTTP_REQUEST>: >>> HTTP Collected<<<
When I disable the HTTP::collect line
Postman sends the request and finishes. Does not keep saying “Sending request”
But, the when HTTP_REQUEST_DATA part is not executed.
I moved these lines to HTTP_REQUEST part:
set token [ regexp -inline -- {“token”: “(.+)”} [HTTP::payload] ]
log local0.debug “Token: $token”
like this:
when HTTP_REQUEST {
if { [HTTP::method] == "POST"} {
log local0. ">>> Method is POST<<<"
set token [ regexp -inline -- {"token": "(.+)"} [HTTP::payload] ]
log local0.debug "Token: $token"
}
}
And now I get in the ltm log:
Apr 29 08:33:45 bigip1 debug tmm2[18399]: Rule /Common/test-iRule <HTTP_REQUEST>: Token: {“token”: “01593317-66f9-4e8a-8467-6f4652e680e3”} 01593317-66f9-4e8a-8467-6f4652e680e3
And I expected to get:
Apr 29 08:33:45 bigip1 debug tmm2[18399]: Rule /Common/test-iRule <HTTP_REQUEST>: Token: 01593317-66f9-4e8a-8467-6f4652e680e3
Thank you for your time.
Noam.