There are a couple of possibilities on this.
Couple of questions first though;
1. Do you ONLY need to be sticky on POSTs, or is it OK to be sticky for GET's (and possibly others) as well?
2. Will a single source IP address (client) ever create more than a single persistent connection to the virtual server?
3. Does the client understand cookies?
4. Is there something the application is using to identify a particular client or track state (e.g. JSESSIONID?)
If you don't care about the GETs..
... and If the clients understand cookies, you don't even need an irule really - just create the virtual server they are using and set the persistence method to cookie.
... and If a client will only make ONE persistent connection to the VS, just use a source_addr persistence method.
... and If the backend app/web service the client is exchangin ginformation with uses something like a JSESSIONID variable set in a header, setup a universal persistence method based on that header value.
OR if you DO care abou the Gets...
.. everything else still applies, but you will need an irule then. A simple one would be;
when HTTP_REQUEST {
if { [HTTP::method] equals "POST" } {
persist source_addr [IP::client_addr]:[TCP::client_port]
}
} else {
persist none
}
For a source_addr based affinity. Just switch up that "persist src_addr blah" line to "persist universal" or "cookie" or whatever you need it to do.
HTH.