Skip to content

Instantly share code, notes, and snippets.

@zveronline
Forked from sielay/gist:0aa4077829f35f5e0310f9e0cc9fdc71
Last active September 29, 2023 07:17
Show Gist options
  • Select an option

  • Save zveronline/4352ebdf7f9888f16a7edf695fc27ead to your computer and use it in GitHub Desktop.

Select an option

Save zveronline/4352ebdf7f9888f16a7edf695fc27ead to your computer and use it in GitHub Desktop.

Revisions

  1. zveronline revised this gist Sep 6, 2023. 1 changed file with 1 addition and 2 deletions.
    3 changes: 1 addition & 2 deletions haproxy-cloudflare
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,3 @@
    acl from_cf src -f /etc/haproxy/cf-ips
    acl cf_ip_hdr req.hdr(Cf-Connecting-Ip) -m found
    http-request set-header X-Forwarded-For %[req.hdr(Cf-Connecting-Ip)] if from_cf cf_ip_hdr
    http-request set-src req.hdr(CF-Connecting-IP) if from_cf
    option forwardfor if-none
  2. zveronline revised this gist Jun 18, 2021. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions haproxy-cloudflare
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    acl from_cf src -f /etc/haproxy/cf-ips
    reqidel ^X-Forwarded-For:.* if ! LOCALHOST
    reqirep ^Cf-Connecting-Ip:(.*)$ X-Forwarded-For:\1 if from_cf
    option forwardfor if-none
    acl from_cf src -f /etc/haproxy/cf-ips
    acl cf_ip_hdr req.hdr(Cf-Connecting-Ip) -m found
    http-request set-header X-Forwarded-For %[req.hdr(Cf-Connecting-Ip)] if from_cf cf_ip_hdr
    option forwardfor if-none
  3. zveronline revised this gist Jun 18, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion haproxy-cloudflare
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    acl from_cf src -f /etc/haproxy/cf-ips
    reqidel ^X-Forwarded-For:.* if ! LOCALHOST
    reqirep ^CF-Connecting-IP:(.*)$ X-Forwarded-For:\1 if from_cf
    reqirep ^Cf-Connecting-Ip:(.*)$ X-Forwarded-For:\1 if from_cf
    option forwardfor if-none
  4. zveronline revised this gist Jun 18, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion haproxy-cloudflare
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    acl from_cf src -f /etc/haproxy/cf-ips-v4
    acl from_cf src -f /etc/haproxy/cf-ips
    reqidel ^X-Forwarded-For:.* if ! LOCALHOST
    reqirep ^CF-Connecting-IP:(.*)$ X-Forwarded-For:\1 if from_cf
    option forwardfor if-none
  5. zveronline revised this gist May 17, 2019. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions haproxy-cloudflare
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    acl FROM_CLOUDFLARE src -f /etc/haproxy/cf-ips-v4
    acl from_cf src -f /etc/haproxy/cf-ips-v4
    reqidel ^X-Forwarded-For:.* if ! LOCALHOST
    reqirep ^CF-Connecting-IP:(.*)$ X-Forwarded-For:\1 if FROM_CLOUDFLARE
    reqirep ^CF-Connecting-IP:(.*)$ X-Forwarded-For:\1 if from_cf
    option forwardfor if-none
  6. zveronline revised this gist May 17, 2019. 1 changed file with 0 additions and 2 deletions.
    2 changes: 0 additions & 2 deletions haproxy-cloudflare
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,4 @@
    acl FROM_CLOUDFLARE src -f /etc/haproxy/cf-ips-v4
    acl FROM_CLOUDFLARE2 src -f /etc/haproxy/cf-ips-v4
    reqidel ^X-Forwarded-For:.* if ! LOCALHOST
    reqirep ^CF-Connecting-IP:(.*)$ X-Forwarded-For:\1 if FROM_CLOUDFLARE
    reqirep ^CF-Connecting-IP:(.*)$ X-Forwarded-For:\1 if FROM_CLOUDFLARE2
    option forwardfor if-none
  7. zveronline revised this gist Dec 25, 2017. 2 changed files with 6 additions and 10 deletions.
    10 changes: 0 additions & 10 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -1,10 +0,0 @@
    frontend www-http
    bind :80
    bind *:443 ssl crt /etc/haproxy/certs no-sslv3

    capture request header X-Forwarded-For len 50

    acl is_cf src -f /etc/haproxy/cf-ips-v4

    http-request set-header X-Client-IP %[src] if !is_cf
    http-request set-header X-Client-IP %[hdr(cf-connecting-ip)] if is_cf
    6 changes: 6 additions & 0 deletions haproxy-cloudflare
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    acl FROM_CLOUDFLARE src -f /etc/haproxy/cf-ips-v4
    acl FROM_CLOUDFLARE2 src -f /etc/haproxy/cf-ips-v4
    reqidel ^X-Forwarded-For:.* if ! LOCALHOST
    reqirep ^CF-Connecting-IP:(.*)$ X-Forwarded-For:\1 if FROM_CLOUDFLARE
    reqirep ^CF-Connecting-IP:(.*)$ X-Forwarded-For:\1 if FROM_CLOUDFLARE2
    option forwardfor if-none
  8. zveronline revised this gist Dec 25, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,7 @@ frontend www-http

    capture request header X-Forwarded-For len 50

    acl is_cf req.hdr(cf-connecting-ip) -m found
    acl is_cf src -f /etc/haproxy/cf-ips-v4

    http-request set-header X-Client-IP %[src] if !is_cf
    http-request set-header X-Client-IP %[hdr(cf-connecting-ip)] if is_cf
  9. @sielay sielay created this gist Aug 10, 2016.
    10 changes: 10 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    frontend www-http
    bind :80
    bind *:443 ssl crt /etc/haproxy/certs no-sslv3

    capture request header X-Forwarded-For len 50

    acl is_cf req.hdr(cf-connecting-ip) -m found

    http-request set-header X-Client-IP %[src] if !is_cf
    http-request set-header X-Client-IP %[hdr(cf-connecting-ip)] if is_cf