Is HAPROXY the right product for me

Hello i have several neewbie question.

I will expose what i want to do and hope somebody can says to me if it’s possible to do it with HAProxy.
If yes I will try to setup it in opnsense (as there is haproxy module).

Ok let’s deep in my need.

One HAProxy in front of several server (vm or not)
I have several domain or sub domain name link to one or several vm. Each (or group of) vm have it’s own Let’s Encrypt certificates. It’s important for me that is the vm that manage their own certificates.
In my case all domain name have only one public ip and each vm have a “private” ip on the lan behind the HAPROXY /opnsense.

A small ascii “art” to help. If i need to provide more information let me know. thx

                                                                                
                                                                                
                                                         ┌────────┐             
                                                 ┌───────┤  vm1   │             
                               domain.com        │       └────────┘             
                                                 │                              
                            ┌────────────────────┤                              
                            │                    │                              
                            │                    │       ┌────────┐             
                            │                    └───────┤  vm2   │             
                            │                            └────────┘             
                            │                                                   
                            │                                                   
                            │                                                   
                            │                                                   
                            │  sub.domain.com                                   
                            │                           ┌─────────┐             
    ┌──────────────┐        ├───────────────────────────┤  vm3    │             
    │              │        │                           └─────────┘             
    │              │        │                                                   
    │              │        │                                                   
    │  HA PROXY    ├────────┤                                                   
    │              │        │                                                   
    │              │        │                                                   
    │              │        │                                                   
    └──────────────┘        │                                                   
                            │                                                   
                            │   domain-one.com          ┌─────────┐             
                            ├───────────────────────────┤  vm4    │             
                            │                           └─────────┘             
                            │                                                   
                            │                                                   
                            │                                                   
                            │                                                   
                            │                                                   
                            │                                                   
                            │   domain-two.com           ┌────────┐             
                            └────────────────────────────┤ vm5    │             
                                                         └────────┘             
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                

Hi,

Nobody can help me ?
At least provide me some pointer to relevant stuff to read ?

thx

I will try to setup something, i will let you know.

It’s possibile, see for example: