I have done passthrough for HTTPS/SSL connections using SNI, but Id don't know if I can do the same for HTTP using host header? is there any way I can use passthrough (tcp mode) in stead of reverse-proxy (http mode) for http connections?
Asked
Active
Viewed 3,829 times
1 Answers
1
Yes, simply create a TCP listener forwarding to your servers. Of course in that case it becomes a layer 4 load balancer and you will not be able to use any layer 7 functions like path and host based routing.
Also make sure to use stickiness if your servers cannot share session information.
listen my_listener
bind *:80
mode tcp
option tcplog
balance leastconn
server server1 1.2.3.4:80
server server2 2.3.4.5:80
For SSL, just use 443.

mzhaase
- 3,798
- 2
- 20
- 32
-
The problem is that I will be able only to listen to one domain. I guess that for HTTP you cannot use tcp mode if you want to act based on host name. – jlanza Aug 22 '18 at 13:25
-
@jlanza Well, yes. A layer 4 load balancer is not aware of anything on higher layers. Http is a layer 7 protocol. As such, of you want to make decisions based on anything happening in layer 7, such as host, path, headers, etc., you need a layer 7 load balancer. – mzhaase Aug 22 '18 at 20:32