Skip to content

Instantly share code, notes, and snippets.

@davidbirdsong
Created October 29, 2019 18:56
Show Gist options
  • Save davidbirdsong/1c3ec695fdbab10f64783437ffab901c to your computer and use it in GitHub Desktop.
Save davidbirdsong/1c3ec695fdbab10f64783437ffab901c to your computer and use it in GitHub Desktop.
do-resolve woes
global
log stdout local0
defaults
mode http
resolvers main_resolver
nameserver dns1 8.8.8.8:53
frontend fe_forwarder
bind 127.0.0.1:8080
log global
option httplog
http-request set-header Host %[req.fhdr(X-Host)]
http-request do-resolve(txn.myip,main_resolver,ipv4) hdr(Host),lower
http-request capture var(txn.myip) len 40
default_backend be_forwarder
backend be_named
server-template serv 1-2 mixpanel.com:443 resolvers main_resolver resolve-prefer ipv4
backend be_forwarder
http-request deny if { var(txn.myip) -m ip 127.0.0.0/8 10.0.0.0/8 }
http-request del-header X-Host
http-request set-dst var(txn.myip)
server clear 0.0.0.0:80
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment