I’m trying to set up proxy in http mode using haproxy. The problem with tcp is that I need to read headers. So what I’m doing wrong? I was tried so many times with different configurations, but it just no working. (Nginx in that case works ok)
p.s. is reverse-proxied servers which available by subdomain
So I would be glad to get any advices with that problem
global
log stdout format raw daemon debug
defaults
log global
option dontlognull
timeout connect 5s
timeout client 30s
timeout server 30s
frontend ws_front
bind *:8000
mode http
http-request set-var(req.cleaned_host) hdr(host)
http-request set-var(req.cleaned_host) var(req.cleaned_host),regsub(^.*://,)
http-request set-var(req.cleaned_host) var(req.cleaned_host),regsub(:.*$,)
http-request set-var(txn.backend_host) var(req.cleaned_host),map(/etc/haproxy/servers_map.txt)
acl is_proxy1 var(txn.backend_host) -m dom proxy1
acl is_proxy2 var(txn.backend_host) -m dom old
acl is_websocket hdr(Upgrade) -I WebSocket
acl is_websocket hdr_beg(Host) -I ws
use_backend nginx_ws_proxy if is_proxy1
use_backend nginx_ws_old if is_proxy2
backend nginx_ws_proxy
mode http
http-request set-header Host <subdomain><domain>
option forwardfor # This sets X-Forwarded-For
timeout queue 5000
timeout server 5000
timeout connect 5000
server nginx_srv <ip1>:8000 ssl verify none
backend nginx_ws_old
mode http
server nginx_srv <ip2>:8002 ssl verify none