HAProxy persistence issue

I have to write HAProxy cofiguration for testing an app. As i am new to HAProxy and not using frequently, need some help which ACL or configuration directive should be used. Following is the logic i have to apply.

Following is the Logic to apply:
A. frontend path
ACL check the path and redirect to backend path_AppName if path contains AppName

Here i think following can be used:
1. acl host_appName path_sub appname  
use_backend pool_appname if host_appname
2. acl url_appname path -i -m beg /appname/
   use_backend backend_pool_appname if url_appname
   Which will be good?

B. frontend AppName
ACL check if cookie is set, if it exists then redirect to corresponding AppName_x backend
ACL Check if param is set, if it exists then redirect to corresponding AppName_x backend
Else go to AppName_default backend

I am unaware of this part. Which ACL will be helpful?

C. backend AppName_default
load balance to 1 instance and set cookie in response
Note: App uses serverid as cookie. Can we use “appsession” in this case?

D. backend path_AppName
redirect to frontend AppName

E. Backend AppName_x
keep session affinity

Regards,
Swapnil.