Hi All,
we are trying that domain base routing in haproxy,in my backend server we are running 3 application. but when hit my url it navigate to only onethe domain.
Please find the below file haproxy configuration file.
defaults
log global
mode http
option httplog
option dontlognull
timeout connect 5000
timeout client 50000
timeout server 50000
errorfile 400 /etc/haproxy/errors/400.http
errorfile 403 /etc/haproxy/errors/403.http
errorfile 408 /etc/haproxy/errors/408.http
errorfile 500 /etc/haproxy/errors/500.http
errorfile 502 /etc/haproxy/errors/502.http
errorfile 503 /etc/haproxy/errors/503.http
errorfile 504 /etc/haproxy/errors/504.http
log-format "%ci %f %b %ST %HM %HU"
frontend http_front
bind *:80
#whitelist hosts
acl is_host1 hdr(host) -i portal.xxxx.com
acl is_host2 hdr(host) -i api.xxxxx.com
acl is_host3 hdr(host) -i skooner.xxxxxx.com
http-request redirect scheme https if is_host1
http-request redirect scheme https if is_host2
http-request redirect scheme https if is_host3
#letsencrypt
acl letsencrypt_acl path_beg /.well-known/acme-challenge/
use_backend letsencrypt_back if letsencrypt_acl
#all unmatched hosts
default_backend deny_back
frontend https_front
bind *:443 ssl crt /etc/haproxy/certs/
#whitelist hosts
acl is_host1 hdr(host) -i portal.xxxx.com
acl is_host2 hdr(host) -i api.xxxx.com
acl is_host3 hdr(host) -i skooner.xxxx.com
#apps
use_backend https_back if is_host1
use_backend https_back if is_host2
use_backend https_back if is_host3
#websocket
acl is_websocket hdr(Connection) -i upgrade
#acl is_websocket hdr(Upgrade) -i websocket
use_backend ws_back if is_websocket
#all unmatched hosts
default_backend deny_back
backend deny_back
#errorfile 403 /var/www/403.http
#http-request deny deny_status 403
http-request silent-drop if TRUE
backend letsencrypt_back
server letsencrypt 127.0.0.1:54321
backend ws_back
#todo: add sticky session
#option http-server-close
#timeout tunnel 1h
server mdm-dev-backend-01 128.199.20.206:6000 check
backend https_back
balance roundrobin
server mdm-dev-apps-01 10.122.64.3:80 check
server mdm-dev-apps-02 10.122.64.4:80 check