Need help with HAProxy configuration

Started by blackwing, June 29, 2023, 02:56:03 AM

Previous topic - Next topic
I need help on configuring HAProxy properly. I got this configuration from Config Export

# Frontend: domain1 (domain1.com)
frontend domain1
    bind public.ip:80 name public.ip:80 ssl alpn h2,http/1.1 crt-list /tmp/haproxy/ssl/6491e75b20ea54.02766459.certlist
    bind public.ip:443 name public.ip:443 ssl alpn h2,http/1.1 crt-list /tmp/haproxy/ssl/6491e75b20ea54.02766459.certlist
    mode http
    option http-keep-alive
    default_backend domain1

    # logging options
    # ACL: domain1
    acl acl_6491e70d7556b9.18780762 hdr_beg(host) -i domain1.com

    # ACTION: domain1Rules
    use_backend domain1 if acl_6491e70d7556b9.18780762

# Frontend: tgwdomain1_PUBSERV (tgw.domain1.com)
frontend tgwdomain1_PUBSERV
    bind public.ip:80 name public.ip:80
    mode http
    option http-keep-alive
    default_backend tgwdomain1_BKENDSERV

    # logging options
    option httplog
    # ACL: tgwdomain1_COND
    acl acl_649cc5f09372a0.09326053 hdr_beg(host) -i tgw.domain1.com

    # ACTION: tgwdomain1Rules
    use_backend tgwdomain1_BKENDSERV if acl_649cc5f09372a0.09326053

# Backend: domain1 (domain1.com)
backend domain1
    # health checking is DISABLED
    mode http
    balance source
    # stickiness
    stick-table type ip size 50k expire 30m 
    stick on src
    http-reuse safe
    server domain1 10.35.2.32:8091

# Backend: tgwdomain1_BKENDSERV (tgw.domain1.com)
backend tgwdomain1_BKENDSERV
    # health checking is DISABLED
    mode http
    balance source
    # stickiness
    stick-table type ip size 50k expire 30m 
    stick on src
    http-reuse safe
    server tgwdomain1SERV 10.35.2.30:80



# statistics are DISABLED



Log says

[28/Jun/2023:17:42:42.203] tgwdomain1_PUBSERV tgwdomain1_PUBSERV/<NOSRV> -1/-1/-1/-1/3 0 0 - - PR-- 22/1/0/0/0 0/0 "<BADREQ>"


I want to use public.ip for all my subdomains, it was able to load domain1.com properly but for tgw.domain1.com it doesn't load, before I was able to make it load but the issue was the subdomain will load what's in domain1.com and vice versa.