HAProxy: Serving simple http page and OpenVpn instance



  • I've setup my PFSense with HAProxy as reverse proxy using a single public IP address, in order to serve my http app, that listen on the port 80, everything works fine, but when i try to setup a TCP OpenVpn, configured on the 443 port, i have to change my application frontend from HTTP to TCP, i mean, everything works fine, but i'm tied to redirect all requests to only a single backend...instead of that i want to use the same mechanism of hostname match and sort the VPN connection to the right server...but i don't know how to do that, in any case, my final goal is to achieve this result:

    Client 1 ---> web.myserver.com ---> PFsense/HAProxy ---> Serve the web app of my server 1 on the port 80
    Client 1 ---> vpn.myserver.com ---> PFsense/HAProxy ---> The client will be able to estabilish a VPN connection to my server 1
    

    And so on with a second server, like below:

    Client 2 ---> web.myserver.com ---> PFsense/HAProxy ---> Serve the web app of my server 2 on the port 80
    Client 2 ---> vpn.myserver.com ---> PFsense/HAProxy ---> The client will be able to estabilish a VPN connection to my server 2
    

    Is this possible?
    Thanks