I have frontend listening on multiple ports and forwarding to backed on ports from 8001 to 8005
I have the following blocks for all 8001-5 ports? This looks redundant to me. Is there any easy of doing it without repeating the blocks for multiple ports?
frontend 8001
bind *:8001 ssl crt /etc/haproxy/certs/current/my.pem ssl crt /etc/haproxy/certs/current
mode http
acl 8001 hdr(host) -i stagesvc-api.kbing.com
acl 8001 hdr(host) -i stagesvc-api.kbing.com:8001
use_backend 8001 if 8001
backend 8001
acl forwarded_proto hdr_cnt(X-Forwarded-Proto) eq 0
acl forwarded_port hdr_cnt(X-Forwarded-Port) eq 0
http-request add-header X-Forwarded-Port %[dst_port] if forwarded_port
http-request add-header X-Forwarded-Proto https if { ssl_fc } forwarded_proto
mode http
server app2 stagesvc-aus.kbing.com:8001 check
frontend 8002…
…
backend 8002…
…
Can somebody help so this can be achieved
5 posts - 2 participants