I am trying to forward requests, locally to haproxy. I cant seem to get it working, I have a script which calls this end point every n sec, and even though i have it set on etc/hosts it doesn't get routed via haproxy ? I do this routing inspecting SNI and applying an acl for the respective backend.
I set on etc/hosts:
127.0.0.2 example.com
Defaults:
defaults
log global
mode tcp
option tcplog
I then have a this defined as Frontend:
frontend default
log global
mode tcp
option tcplog
bind *:443
tcp-request inspect-delay 1s
tcp-request content accept if { req_ssl_hello_type 1 }
acl example_us req_ssl_sni -i example.com
use_backend example_us if example_us
Resolvers:
resolvers mynameservers
nameserver ns1 8.8.8.8:53
Backend:
backend example_us
option external-check
external-check command /usr/local/bin/healthcheck
server s1 example.com:443 check inter 1m resolvers mynameservers fall 5 rise 1 resolve-prefer ipv4
I have add resolver so i could pick up example.com ip via 8.8.8.8, but locally i would have it forwarding to a loopback interface.
I was looking to do example.com -> localhost:443 -> haproxy -> example.com
Is this possible ? i am having trouble figuring this out