submit client request before http redirect

Is there a way to send the client request to the downstream server before redirecting the client? so desired flow is 1, when http request 2, if uri eq /logout (for example) 3, pass request to a downstream server (jsessionid persistence is in use) 4, redirect the user to the homepage. Thanks in advance

You can detect logout uri in HTTP_REQUEST and redirect in HTTP_RESPONSE

when HTTP_REQUEST {    
    if {[HTTP::path] equals "/logout"} {        
        set logout 1            
    } else {        
        set logout 0            
    }            
}       

when HTTP_RESPONSE {        
    if {$logout} {        
        HTTP::redirect /foo            
    }
}