Hi I have managed to do this without using TCP::collect. I have borrowed the idea from this post https://devcentral.f5.com/codeshare/http-method-conversion, but without the need to use 2 separate virtual servers.
The following iRule will convert a GET request with query parameters into a POST to the same path, but placing the query parameters in the request body instead of the request line.
Be careful....you could exhaust all your connections on the box if you tinker with it and get it wrong 🙂
when HTTP_REQUEST {
set pool [LB::server pool]
set method [HTTP::method]
if {[HTTP::uri] eq "/reentrant"} {
HTTP::respond 200
return
} elseif {[HTTP::method] eq "GET"} {
Create POST
set post "POST [HTTP::path] HTTP/1.1\r\nHost: [HTTP::host]\r\nContent-Type: text/plain\r\nContent-Length: [string length [URI::query [HTTP::uri]]]\r\n\r\n[URI::query [HTTP::uri]]"
Change the uri so that when this event is fired again we know to return a 200
HTTP::uri "/reentrant"
Invoke this iRule again re-entrantly
virtual [virtual]
}
}
when HTTP_RESPONSE {
If the clientside request was a GET, retry as a POST
if {$method eq "GET"} {
pool $pool
HTTP::retry $post
return
}
}