Created
October 19, 2016 16:43
-
-
Save double-p/6b371eb9701dd6481cacbb28f8a973fe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
frontend whatever | |
acl badclient_ips hdr(CF-connecting-IP) -f /etc/haproxy/badclient_ips.lst | |
acl badclient_ips src -f /etc/haproxy/badclient_ips.lst | |
http-request deny if badclient_ips | |
backend from_above | |
acl new_hdr hdr_reg(CF-connecting-IP) [0-9]*\.[0-9]*\.[0-9]*\.[0-9]* | |
http-request set-header Proxy-ip %ci if !new_hdr | |
http-request set-header X-Real-IP %ci if !new_hdr | |
http-request set-header Proxy-ip %[req.hdr(CF-connecting-IP)] if new_hdr | |
http-request set-header X-Real-IP %[req.hdr(CF-connecting-IP)] if new_hdr |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment