SSL end-to-end with URL rewrite

Hello,

Can I accomplish this task using haproxy?

There are two serverfarms sharepoint2013 and sharepoint2019.
I want the loadbalancer to replace requests to specific URL sp.mycompany.com/forms/form1 with sp19.mycompany.com/forms/form1 transparently for users. Also the loadbalancer must send these requests to another server farm (sharepoint2019). But by default if requests goes to sp.mycompany.com/ or other URI at this domain, loadbalancer must send to sharepoint2013 serverfarm.

DNS record sp.mycompany.com points to sharepoint2013 serverfarm

DNS record sp19.mycompany.com points to sharepoint2019 serverfarm

Thank you!