iRule POST Magic?

Is it possible to apply an iRule that would watch for POSTs to URIs NOT equal to a certain value and contains specific parameters (username and password) and then on the fly, change the POST to point to a URI of our desire and then continue logging the user in ?

This is an abstract, but it should give you an idea of what’s involved:

when HTTP_REQUEST {    
    if { ( [HTTP::method] equals "POST" ) and not ( [HTTP::uri] equals "/foo" ) } {        
        HTTP::collect [HTTP::header Content-Length]
    }        
}    
when HTTP_REQUEST_DATA {      
    if { [HTTP::payload] contains "username=" } {
        HTTP::uri "/foo"            
         implement any other changes to POST request here
    }        
}