Quantcast
Channel: HAProxy community - Latest topics
Viewing all articles
Browse latest Browse all 4733

Help me to configurations backend with proxy server

$
0
0

@tu.vu wrote:

Hello !
I used haproxy version 1.8.8
I have backend is multi-servers, but some server use proxy server. It use only one public IP to the internet but mapping by domain (same virtual-host). All backend servers is same all mandates, functions …

I have diagram:

Clients --> Haproxy-Server ---> Server 1 ( have IP: xxx.yyy.zzz.kkk  domain: testhaproxy1.com )
                           ---> Server 2 ( have IP: aaa.bbb.ccc.ddd  domain: testhaproxy2.com )
                           ---> Server 3 ( have IP: aaa.bbb.ccc.ddd  domain: testhaproxy3.com - same IP with server 2 )
                           ---> Server 4 ( have IP: aaa.bbb.ccc.ddd  domain: testhaproxy4.com- same IP with server 2 )

My current haproxy.cfg

frontend http-in
        bind *:80
        mode http 
	use_backend bke_servers

backend bke_servers
	balance roundrobin
	option forwardfor
	option external-check
	external-check path "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
	external-check command "/var/lib/haproxy/loadbalancer"
	default-server inter 15s downinter 5s fall 3 rise 2
	#http-send-name-header Host
	server server1 testhaproxy1.com:80 check weight 20
	server server2 testhaproxy2.com:80 check weight 20
	server server3 testhaproxy3.com:80 check weight 30
	server server4 testhaproxy4.com:80 check weight 30

Proplem:
1/ When I use check health by httpchk GET - server 2,3,4, the haproxy check always send request to their IP. So, it failed. I need write the shell script to check by external-check ( if server name is server1 --> send request check to testhaproxy1.com --> if ok exit 1 else exit -1).
2/ When I tried send request to proxy server - I got failed results, it return code status 502 Bad Gateway. And I tried to check root problem is haproxy always send request to IP - not to domain of each servers.

I tried to use http-request set-header Host - but it only used for only one server. I don’t know:
How to I can set Host same: http-request set-header Host testhaproxy1.com if { server_name server1 }
Or How to: I can configuration haproxy send request exactly to domain - not to IP ?

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4733

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>