Introduction

Pangolin automatically gets the correct client IP when you are using Cloudflare, but unfortunately it does not do the same for BunnyCDN. In fact, I found no resources online regarding how to get the visitor’s IP when behind BunnyCDN. This blog post will walk through setting up Pangolin to get the client’s real IP.

Traefik Middleware

Simply editing the badger middleware (what gets the correct client IP) in config/traefik/dynamic_config.yml doesn’t work, because Pangolin overrides your configuration. Therefore, we need to create a separate configuration file and define a new middleware.

  1. In the traefik directory of your config folder (e.g. config/traefik) create a new folder called dynamic. After creation, move the dynamic_config.yml file to that directory:
mkdir dynamic
mv dynamic_config.yml dynamic/
  1. Create a new file called badger-bunny.yml. In this situation, the command below will receive the file contents from this blog website.
curl -o dynamic/badger-bunny.yml https://blog.solomon.tech/downloads/badger-bunny.yml

Edit the “Docker internal” trusted IP if your Pangolin subnet is different.

  1. Reference the new configuration folder in traefik_config.yml

Inside the traefik_config.yml file, remove the previous file entry and replace it with the directory. Your configuration should look like this:

providers:
  http:
    endpoint: "http://pangolin:3001/api/v1/traefik-config"
    pollInterval: "5s"
  file:
    directory: "/etc/traefik/dynamic"
    watch: true
  1. Apply the custom middleware to all routers

Edit Pangolin’s config.yml file. This is usually in the config directory.

Append the following to the config.yml file:

traefik:
  additional_middlewares:
    - "badger-bunny@file"

This will apply the custom middleware we just created to all routers managed by Pangolin.

Traefik Trusted IPs

We need to trust BunnyCDN’s IPs in Traefik’s entrypoints.

  1. Copy and paste the following (very long!) code snippet into the top of the traefik_config.yml file:
x-trusted-ips: &trustedIPs
          - "5.9.71.119/32"
          - "5.9.98.45/32"
          - "5.9.99.73/32"
          - "5.9.144.178/32"
          - "5.42.206.66/32"
          - "5.189.202.62/32"
          - "8.52.139.20/32"
          - "8.52.139.28/32"
          - "8.52.139.36/32"
          - "8.52.139.44/32"
          - "8.52.139.52/32"
          - "8.52.139.60/32"
          - "8.52.139.100/32"
          - "8.52.139.108/32"
          - "8.52.139.148/32"
          - "8.52.139.156/32"
          - "8.52.139.212/32"
          - "8.52.139.220/32"
          - "8.52.139.228/32"
          - "8.52.139.236/32"
          - "8.52.139.244/32"
          - "8.52.184.12/32"
          - "8.52.184.52/32"
          - "8.52.184.148/32"
          - "8.52.184.156/32"
          - "8.52.184.164/32"
          - "8.52.184.172/32"
          - "8.52.184.180/32"
          - "8.52.184.188/32"
          - "37.19.203.178/32"
          - "37.19.207.34/32"
          - "37.19.207.37/32"
          - "37.19.207.38/32"
          - "37.19.215.33/32"
          - "37.19.216.130/32"
          - "37.19.222.34/32"
          - "37.19.222.248/31"
          - "37.27.135.61/32"
          - "37.236.234.2/32"
          - "38.32.110.58/32"
          - "38.54.3.92/32"
          - "38.54.5.37/32"
          - "38.104.169.186/32"
          - "38.142.94.218/32"
          - "41.242.2.18/32"
          - "45.125.247.57/32"
          - "45.156.248.73/32"
          - "46.4.102.90/32"
          - "46.4.113.143/32"
          - "46.4.116.17/32"
          - "46.4.119.81/32"
          - "46.4.120.152/32"
          - "46.151.193.85/32"
          - "46.151.193.86/32"
          - "46.151.194.242/31"
          - "46.199.75.115/32"
          - "49.12.0.158/32"
          - "49.12.71.27/32"
          - "51.83.172.163/32"
          - "64.185.232.82/32"
          - "64.185.232.178/32"
          - "64.185.232.194/32"
          - "64.185.234.114/32"
          - "64.185.235.90/32"
          - "66.181.163.74/32"
          - "78.46.69.199/32"
          - "78.46.74.85/32"
          - "78.46.74.86/32"
          - "78.46.92.118/32"
          - "78.46.123.17/32"
          - "78.46.156.89/32"
          - "78.47.94.156/32"
          - "79.127.134.129/32"
          - "79.127.134.130/31"
          - "79.127.134.132/31"
          - "79.127.134.225/32"
          - "79.127.134.226/31"
          - "79.127.134.228/30"
          - "79.127.134.234/31"
          - "79.127.165.46/31"
          - "79.127.165.48/30"
          - "79.127.188.193/32"
          - "79.127.188.194/31"
          - "79.127.188.196/32"
          - "79.127.204.113/32"
          - "79.127.213.209/32"
          - "79.127.213.210/32"
          - "79.127.213.214/31"
          - "79.127.213.216/31"
          - "79.127.216.66/32"
          - "79.127.216.111/32"
          - "79.127.216.112/32"
          - "79.127.219.198/32"
          - "79.127.221.146/32"
          - "79.127.226.194/31"
          - "79.127.226.207/32"
          - "79.127.237.99/32"
          - "79.127.237.104/32"
          - "79.127.237.132/32"
          - "79.127.242.89/32"
          - "79.127.243.187/32"
          - "84.17.37.209/32"
          - "84.17.37.211/32"
          - "84.17.37.217/32"
          - "84.17.38.225/32"
          - "84.17.38.226/31"
          - "84.17.38.228/30"
          - "84.17.38.232/31"
          - "84.17.38.234/32"
          - "84.17.38.243/32"
          - "84.17.38.244/30"
          - "84.17.38.248/32"
          - "84.17.38.250/31"
          - "84.17.46.49/32"
          - "84.17.46.53/32"
          - "84.17.46.54/32"
          - "84.17.59.115/32"
          - "84.17.59.117/32"
          - "84.17.59.119/32"
          - "84.17.59.120/32"
          - "84.17.63.178/32"
          - "87.249.137.52/32"
          - "88.99.26.189/32"
          - "88.99.63.113/32"
          - "88.99.95.221/32"
          - "88.198.9.155/32"
          - "88.198.22.103/32"
          - "88.198.57.50/32"
          - "88.218.3.190/32"
          - "89.187.162.242/32"
          - "89.187.162.249/32"
          - "89.187.165.194/32"
          - "89.187.169.47/32"
          - "89.187.176.34/32"
          - "89.187.179.7/32"
          - "89.187.184.173/32"
          - "89.187.184.176/30"
          - "89.187.188.227/32"
          - "89.187.188.228/32"
          - "93.180.217.214/32"
          - "94.20.154.22/32"
          - "94.46.27.186/32"
          - "94.128.254.166/32"
          - "94.130.68.122/32"
          - "94.130.204.110/32"
          - "98.98.242.142/32"
          - "102.67.138.155/32"
          - "102.219.126.20/32"
          - "103.60.15.162/31"
          - "103.60.15.164/30"
          - "103.60.15.168/30"
          - "103.60.15.172/31"
          - "103.108.229.5/32"
          - "103.108.231.41/32"
          - "103.135.249.250/32"
          - "103.212.227.9/32"
          - "103.214.20.95/32"
          - "103.216.220.9/32"
          - "103.235.199.170/32"
          - "104.166.144.106/32"
          - "104.237.51.58/32"
          - "104.237.53.74/32"
          - "104.237.54.154/32"
          - "107.155.47.146/32"
          - "107.182.163.162/32"
          - "109.61.83.97/32"
          - "109.61.83.98/31"
          - "109.61.83.241/32"
          - "109.61.83.242/31"
          - "109.61.83.244/30"
          - "109.61.83.249/32"
          - "109.61.83.250/31"
          - "109.61.86.193/32"
          - "109.61.89.52/32"
          - "109.61.89.58/32"
          - "109.248.43.35/32"
          - "109.248.43.103/32"
          - "109.248.43.116/31"
          - "109.248.43.159/32"
          - "109.248.43.160/32"
          - "109.248.43.162/32"
          - "109.248.43.164/31"
          - "109.248.43.179/32"
          - "109.248.43.208/32"
          - "109.248.43.231/32"
          - "109.248.43.232/32"
          - "109.248.43.236/32"
          - "109.248.43.240/31"
          - "116.202.80.29/32"
          - "116.202.80.247/32"
          - "116.202.118.194/32"
          - "116.202.155.146/32"
          - "116.202.193.178/32"
          - "116.202.224.168/32"
          - "116.202.235.16/32"
          - "122.10.251.130/32"
          - "128.1.35.170/32"
          - "128.1.52.179/32"
          - "128.140.70.141/32"
          - "129.227.179.18/32"
          - "129.227.217.178/31"
          - "136.243.2.236/32"
          - "136.243.16.49/32"
          - "136.243.42.10/32"
          - "136.243.42.90/32"
          - "136.243.70.170/32"
          - "138.199.4.129/32"
          - "138.199.4.136/32"
          - "138.199.4.177/32"
          - "138.199.4.178/31"
          - "138.199.9.104/32"
          - "138.199.15.193/32"
          - "138.199.24.209/32"
          - "138.199.24.211/32"
          - "138.199.24.218/31"
          - "138.199.33.53/32"
          - "138.199.33.57/32"
          - "138.199.36.7/32"
          - "138.199.36.8/30"
          - "138.199.37.225/32"
          - "138.199.37.227/32"
          - "138.199.37.229/32"
          - "138.199.37.230/31"
          - "138.199.37.232/32"
          - "138.199.40.58/32"
          - "138.199.46.65/32"
          - "138.199.46.66/31"
          - "138.199.46.68/31"
          - "138.201.20.168/32"
          - "138.201.51.89/32"
          - "138.201.86.122/32"
          - "139.84.163.144/32"
          - "139.99.174.7/32"
          - "139.180.129.216/32"
          - "141.164.35.160/32"
          - "141.227.142.242/32"
          - "142.132.223.79/32"
          - "142.132.223.80/31"
          - "143.244.38.129/32"
          - "143.244.38.133/32"
          - "143.244.38.134/32"
          - "143.244.45.177/32"
          - "143.244.49.177/32"
          - "143.244.49.178/31"
          - "143.244.49.180/32"
          - "143.244.49.183/32"
          - "143.244.50.82/31"
          - "143.244.50.84/30"
          - "143.244.50.88/30"
          - "143.244.50.209/32"
          - "143.244.50.210/31"
          - "143.244.50.212/31"
          - "143.244.50.214/32"
          - "143.244.56.49/32"
          - "143.244.56.50/31"
          - "143.244.56.52/30"
          - "143.244.56.56/31"
          - "143.244.56.58/32"
          - "143.244.60.193/32"
          - "143.244.60.195/32"
          - "143.244.60.196/31"
          - "144.76.65.213/32"
          - "144.76.79.22/32"
          - "144.76.236.44/32"
          - "146.59.69.202/32"
          - "146.185.248.15/32"
          - "148.113.190.161/32"
          - "148.251.41.244/32"
          - "148.251.42.123/32"
          - "148.251.129.132/32"
          - "148.251.129.217/32"
          - "148.251.131.73/32"
          - "148.251.131.74/32"
          - "148.251.131.238/32"
          - "152.89.160.26/32"
          - "152.233.22.97/32"
          - "152.233.22.98/31"
          - "152.233.22.100/30"
          - "154.93.86.71/32"
          - "154.95.86.76/32"
          - "156.59.66.182/32"
          - "156.59.92.126/32"
          - "156.59.95.218/32"
          - "156.59.126.78/32"
          - "156.146.40.49/32"
          - "156.146.43.65/32"
          - "156.146.43.68/32"
          - "156.146.43.70/31"
          - "156.146.43.72/32"
          - "156.146.56.161/32"
          - "156.146.56.162/31"
          - "156.146.56.166/31"
          - "156.146.56.168/30"
          - "157.90.180.205/32"
          - "158.51.123.205/32"
          - "159.69.57.80/32"
          - "159.69.68.171/32"
          - "162.55.135.11/32"
          - "167.235.114.167/32"
          - "168.119.12.188/32"
          - "168.119.39.238/32"
          - "169.150.202.210/32"
          - "169.150.207.49/32"
          - "169.150.207.51/32"
          - "169.150.207.210/31"
          - "169.150.207.212/30"
          - "169.150.207.216/31"
          - "169.150.213.50/32"
          - "169.150.215.115/32"
          - "169.150.219.114/32"
          - "169.150.220.228/30"
          - "169.150.220.235/32"
          - "169.150.221.147/32"
          - "169.150.225.34/31"
          - "169.150.225.36/30"
          - "169.150.225.40/30"
          - "169.150.236.97/32"
          - "169.150.236.98/31"
          - "169.150.236.100/32"
          - "169.150.236.106/31"
          - "169.150.238.19/32"
          - "169.150.242.193/32"
          - "169.150.247.33/32"
          - "169.150.247.34/31"
          - "169.150.247.36/30"
          - "169.150.247.40/32"
          - "169.150.247.179/32"
          - "169.150.247.180/31"
          - "169.150.247.182/32"
          - "169.150.249.162/31"
          - "169.150.249.164/30"
          - "169.150.249.168/31"
          - "169.150.252.209/32"
          - "172.255.253.140/32"
          - "176.9.139.55/32"
          - "176.9.139.94/32"
          - "178.63.2.112/32"
          - "178.63.21.52/32"
          - "178.63.41.234/32"
          - "178.63.41.242/32"
          - "178.63.41.247/32"
          - "178.175.134.51/32"
          - "180.149.231.175/32"
          - "181.174.168.102/32"
          - "185.24.11.18/31"
          - "185.40.106.117/32"
          - "185.59.220.198/31"
          - "185.93.1.242/31"
          - "185.93.1.244/30"
          - "185.93.1.249/32"
          - "185.93.1.250/31"
          - "185.93.2.243/32"
          - "185.93.2.244/31"
          - "185.93.2.246/32"
          - "185.93.2.248/32"
          - "185.93.2.251/32"
          - "185.93.3.243/32"
          - "185.93.3.244/32"
          - "185.93.3.246/32"
          - "185.102.217.65/32"
          - "185.111.111.154/31"
          - "185.111.111.156/30"
          - "185.111.111.160/32"
          - "185.111.111.164/32"
          - "185.111.111.166/31"
          - "185.111.111.168/30"
          - "185.111.111.172/32"
          - "185.131.64.124/32"
          - "185.135.85.154/32"
          - "185.152.64.17/32"
          - "185.152.64.19/32"
          - "185.152.64.23/32"
          - "185.152.66.247/32"
          - "185.165.170.74/32"
          - "185.180.12.68/32"
          - "185.180.14.250/32"
          - "185.229.190.147/32"
          - "185.229.190.148/32"
          - "188.40.126.227/32"
          - "192.169.120.162/32"
          - "192.189.65.146/32"
          - "193.162.131.1/32"
          - "193.201.190.174/32"
          - "194.242.11.186/32"
          - "195.69.140.112/32"
          - "195.181.163.194/31"
          - "195.181.163.196/32"
          - "195.181.163.198/32"
          - "195.181.163.202/31"
          - "195.181.166.158/32"
          - "195.201.11.156/32"
          - "195.201.81.217/32"
          - "195.201.109.59/32"
          - "195.206.229.69/32"
          - "195.238.127.98/32"
          - "200.25.11.8/32"
          - "200.25.16.103/32"
          - "200.25.18.73/32"
          - "200.25.22.6/32"
          - "200.25.32.131/32"
          - "200.25.36.166/32"
          - "200.25.38.69/32"
          - "200.25.42.70/32"
          - "200.25.45.4/32"
          - "200.25.53.5/32"
          - "200.25.57.5/32"
          - "200.25.62.5/32"
          - "200.25.70.101/32"
          - "200.25.80.74/32"
          - "200.25.86.90/32"
          - "203.57.82.97/32"
          - "203.57.82.99/32"
          - "203.57.82.101/32"
          - "207.121.15.92/32"
          - "207.121.15.100/32"
          - "207.121.15.108/32"
          - "207.121.15.124/32"
          - "207.121.15.172/32"
          - "207.121.15.180/32"
          - "207.121.15.196/32"
          - "207.121.15.204/32"
          - "207.121.15.212/32"
          - "207.121.15.220/32"
          - "207.121.15.228/32"
          - "207.121.15.236/32"
          - "207.121.15.244/32"
          - "207.121.15.252/32"
          - "207.121.46.148/32"
          - "207.121.46.156/32"
          - "207.121.46.188/32"
          - "207.121.46.212/32"
          - "207.121.46.220/32"
          - "207.121.46.228/32"
          - "207.121.46.236/32"
          - "207.121.75.132/32"
          - "207.121.80.12/32"
          - "207.121.80.172/32"
          - "207.121.90.60/32"
          - "207.211.214.145/32"
          - "208.83.234.224/32"
          - "208.91.111.227/32"
          - "209.177.87.197/32"
          - "212.102.40.113/32"
          - "212.102.40.114/32"
          - "212.102.40.120/32"
          - "212.102.46.115/32"
          - "212.102.46.118/31"
          - "212.102.50.49/32"
          - "212.102.50.50/32"
          - "212.102.50.52/32"
          - "212.102.50.54/32"
          - "212.102.50.59/32"
          - "216.202.194.52/32"
          - "216.202.194.252/32"
          - "2001:550:2:38::28:2/128"
          - "2001:550:2:6f::f3:2/128"
          - "2001:550:2:dc::5e:2/128"
          - "2001:1900:22b3:80d::4/128"
          - "2001:1900:22b3:80e::4/128"
          - "2001:1900:22b3:810::4/128"
          - "2001:1900:22b3:81d::4/128"
          - "2001:1900:22b3:81e::4/128"
          - "2001:1900:22b3:820::4/128"
          - "2001:1900:22b3:829::4/128"
          - "2001:1900:22b3:832::4/128"
          - "2001:1900:22b3:160d::4/128"
          - "2001:1900:22b3:1610::4/128"
          - "2001:1900:22b3:1612::4/128"
          - "2001:1900:22b3:1613::4/128"
          - "2001:1900:22b3:180f::4/128"
          - "2001:1900:22b3:1810::4/128"
          - "2001:1900:22b3:1811::4/128"
          - "2001:1900:22b3:1812::4/128"
          - "2001:1900:22b3:1813::4/128"
          - "2001:1900:22b3:1814::4/128"
          - "2001:1900:22b3:1815::4/128"
          - "2001:1900:22b3:1816::4/128"
          - "2001:1900:22b3:1817::4/128"
          - "2001:1900:22b3:1818::4/128"
          - "2001:1900:22b3:1819::4/128"
          - "2001:1900:22b3:181a::4/128"
          - "2001:1900:22b3:181b::4/128"
          - "2001:1900:22b3:181c::4/128"
          - "2001:1900:22b3:181d::4/128"
          - "2001:1900:22b3:2212::4/128"
          - "2001:1900:22b3:2213::4/128"
          - "2001:1900:22b3:2214::4/128"
          - "2001:1900:22b3:2215::4/128"
          - "2001:1900:22b3:2216::4/128"
          - "2001:1900:22b3:2217::4/128"
          - "2001:1900:22b3:2218::4/128"
          - "2001:1900:22b3:2219::4/128"
          - "2001:1900:22b3:221a::4/128"
          - "2001:1900:22b3:221b::4/128"
          - "2001:1900:22b3:221c::4/128"
          - "2001:1900:22b3:221d::4/128"
          - "2001:1900:22b3:221e::4/128"
          - "2001:1900:22b3:221f::4/128"
          - "2001:1900:22b3:2220::4/128"
          - "2001:1900:22b3:2221::4/128"
          - "2001:1900:22b3:8c01::4/128"
          - "2001:1900:22b3:8c02::4/128"
          - "2001:1900:22b3:8c03::4/128"
          - "2001:1900:22b3:8c04::4/128"
          - "2001:1900:22b3:8c05::4/128"
          - "2001:1900:22b3:8c06::4/128"
          - "2001:1900:22b3:8c07::4/128"
          - "2001:19f0:c000:c8cd:5400:5ff:fe7a:fb7/128"
          - "2001:41d0:605:ca00::1175:1/128"
          - "2400:52e0:1500::714:1/128"
          - "2400:52e0:1500::715:1/128"
          - "2400:52e0:1500::747:1/128"
          - "2400:52e0:1500::749:1/128"
          - "2400:52e0:1500::782:1/128"
          - "2400:52e0:1500::858:1/128"
          - "2400:52e0:1500::867:1/128"
          - "2400:52e0:1500::868:1/128"
          - "2400:52e0:1500::869:1/128"
          - "2400:52e0:1500::944:1/128"
          - "2400:52e0:1500::945:1/128"
          - "2400:52e0:1500::955:1/128"
          - "2400:52e0:1500::977:1/128"
          - "2400:52e0:1500::978:1/128"
          - "2400:52e0:1500::979:1/128"
          - "2400:52e0:1500::980:1/128"
          - "2400:52e0:1500::981:1/128"
          - "2400:52e0:1500::982:1/128"
          - "2400:52e0:1500::988:1/128"
          - "2400:52e0:1500::989:1/128"
          - "2400:52e0:1500::1020:1/128"
          - "2400:52e0:1500::1021:1/128"
          - "2400:52e0:1500::1022:1/128"
          - "2400:52e0:1500::1024:1/128"
          - "2400:52e0:1500::1030:1/128"
          - "2400:52e0:1500::1031:1/128"
          - "2400:52e0:1500::1091:1/128"
          - "2400:52e0:1500::1092:1/128"
          - "2400:52e0:1500::1093:1/128"
          - "2400:52e0:1500::1094:1/128"
          - "2400:52e0:1500::1095:1/128"
          - "2400:52e0:1500::1096:1/128"
          - "2400:52e0:1500::1173:1/128"
          - "2400:52e0:1500::1174:1/128"
          - "2400:52e0:1500::1179:1/128"
          - "2400:52e0:1500::1180:1/128"
          - "2400:52e0:1500::1181:1/128"
          - "2400:52e0:1500::1182:1/128"
          - "2400:52e0:1500::1272:1/128"
          - "2400:52e0:1500::1274:1/128"
          - "2400:52e0:1501::990:1/128"
          - "2400:52e0:1501::1061:1/128"
          - "2400:52e0:1501::1062:1/128"
          - "2400:52e0:1501::1063:1/128"
          - "2400:52e0:1501::1064:1/128"
          - "2400:52e0:1501::1065:1/128"
          - "2400:52e0:1501::1066:1/128"
          - "2400:52e0:1501::1097:1/128"
          - "2400:52e0:1501::1098:1/128"
          - "2400:52e0:1501::1143:1/128"
          - "2400:52e0:1501::1145:1/128"
          - "2400:52e0:1501::1146:1/128"
          - "2400:52e0:1501::1147:1/128"
          - "2400:52e0:1501::1148:1/128"
          - "2400:52e0:1501::1149:1/128"
          - "2400:52e0:1501::1150:1/128"
          - "2400:52e0:1501::1171:1/128"
          - "2400:52e0:1501::1172:1/128"
          - "2400:52e0:1501::1184:1/128"
          - "2400:52e0:1501::1185:1/128"
          - "2400:52e0:1501::1188:1/128"
          - "2400:52e0:1501::1189:1/128"
          - "2400:52e0:1501::1190:1/128"
          - "2400:52e0:1501::1193:1/128"
          - "2400:52e0:1501::1194:1/128"
          - "2400:52e0:1501::1195:1/128"
          - "2400:52e0:1502::1059:1/128"
          - "2400:52e0:1690::1156:1/128"
          - "2400:52e0:1690::1157:1/128"
          - "2400:52e0:1690::1158:1/128"
          - "2400:52e0:1690::1159:1/128"
          - "2400:52e0:1690::1160:1/128"
          - "2400:52e0:1690::1168:1/128"
          - "2400:52e0:1690::1341:1/128"
          - "2400:52e0:1690::1342:1/128"
          - "2400:52e0:1a00::718:1/128"
          - "2400:52e0:1a00::845:1/128"
          - "2400:52e0:1a00::871:1/128"
          - "2400:52e0:1a00::894:1/128"
          - "2400:52e0:1a00::940:1/128"
          - "2400:52e0:1a00::941:1/128"
          - "2400:52e0:1a00::1029:1/128"
          - "2400:52e0:1a00::1067:1/128"
          - "2400:52e0:1a00::1068:1/128"
          - "2400:52e0:1a00::1069:1/128"
          - "2400:52e0:1a00::1070:1/128"
          - "2400:52e0:1a00::1232:1/128"
          - "2400:52e0:1a00::1233:1/128"
          - "2400:52e0:1a00::1234:1/128"
          - "2400:52e0:1a00::1235:1/128"
          - "2400:52e0:1a00::1236:1/128"
          - "2400:52e0:1a00::1346:1/128"
          - "2400:52e0:1a00::1347:1/128"
          - "2400:52e0:1a00::1348:1/128"
          - "2400:52e0:1a01::852:1/128"
          - "2400:52e0:1a01::899:1/128"
          - "2400:52e0:1a01::900:1/128"
          - "2400:52e0:1a01::907:1/128"
          - "2400:52e0:1a01::912:1/128"
          - "2400:52e0:1a01::953:1/128"
          - "2400:52e0:1a01::954:1/128"
          - "2400:52e0:1a01::984:1/128"
          - "2400:52e0:1a01::985:1/128"
          - "2400:52e0:1a01::986:1/128"
          - "2400:52e0:1a01::987:1/128"
          - "2400:52e0:1a01::992:1/128"
          - "2400:52e0:1a01::993:1/128"
          - "2400:52e0:1a01::994:1/128"
          - "2400:52e0:1a01::995:1/128"
          - "2400:52e0:1a01::996:1/128"
          - "2400:52e0:1a01::997:1/128"
          - "2400:52e0:1a01::998:1/128"
          - "2400:52e0:1a01::999:1/128"
          - "2400:52e0:1a01::1000:1/128"
          - "2400:52e0:1a01::1001:1/128"
          - "2400:52e0:1a01::1002:1/128"
          - "2400:52e0:1a01::1108:1/128"
          - "2400:52e0:1a01::1109:1/128"
          - "2400:52e0:1a01::1110:1/128"
          - "2400:52e0:1a01::1111:1/128"
          - "2400:52e0:1a01::1112:1/128"
          - "2400:52e0:1a01::1113:1/128"
          - "2400:52e0:1a01::1114:1/128"
          - "2400:52e0:1a01::1115:1/128"
          - "2400:52e0:1a02::876:1/128"
          - "2400:52e0:1a02::878:1/128"
          - "2400:52e0:1a02::974:1/128"
          - "2400:52e0:1a02::975:1/128"
          - "2400:52e0:1a02::976:1/128"
          - "2400:52e0:1a02::1210:1/128"
          - "2400:52e0:1a02::1211:1/128"
          - "2400:52e0:1a02::1212:1/128"
          - "2400:52e0:1a02::1239:1/128"
          - "2400:52e0:1a02::1240:1/128"
          - "2400:52e0:1a02::1241:1/128"
          - "2400:52e0:1a02::1242:1/128"
          - "2400:52e0:1a02::1243:1/128"
          - "2400:52e0:1a02:2::1351:1/128"
          - "2400:52e0:1a02:2::1352:1/128"
          - "2400:52e0:1a02:2::1353:1/128"
          - "2400:52e0:1a02:2::1354:1/128"
          - "2400:52e0:1a02:2::1355:1/128"
          - "2400:52e0:1a02:2::1356:1/128"
          - "2400:52e0:1a02:2::1357:1/128"
          - "2400:52e0:1a04::1310:1/128"
          - "2400:52e0:1a05::1120:1/128"
          - "2400:52e0:1a05::1431:1/128"
          - "2400:52e0:1a06::1025:1/128"
          - "2400:52e0:1e00::722:1/128"
          - "2400:52e0:1e00::723:1/128"
          - "2400:52e0:1e00::752:1/128"
          - "2400:52e0:1e00::755:1/128"
          - "2400:52e0:1e00::860:1/128"
          - "2400:52e0:1e00::863:1/128"
          - "2400:52e0:1e00::864:1/128"
          - "2400:52e0:1e00::865:1/128"
          - "2400:52e0:1e00::874:1/128"
          - "2400:52e0:1e00::1047:1/128"
          - "2400:52e0:1e00::1048:1/128"
          - "2400:52e0:1e00::1049:1/128"
          - "2400:52e0:1e00::1053:1/128"
          - "2400:52e0:1e00::1054:1/128"
          - "2400:52e0:1e00::1055:1/128"
          - "2400:52e0:1e00::1075:1/128"
          - "2400:52e0:1e00::1076:1/128"
          - "2400:52e0:1e00::1077:1/128"
          - "2400:52e0:1e00::1078:1/128"
          - "2400:52e0:1e00::1079:1/128"
          - "2400:52e0:1e00::1080:1/128"
          - "2400:52e0:1e00::1081:1/128"
          - "2400:52e0:1e00::1082:1/128"
          - "2400:52e0:1e00:2::1328:1/128"
          - "2400:52e0:1e00:2::1329:1/128"
          - "2400:52e0:1e00:2::1330:1/128"
          - "2400:52e0:1e00:2::1331:1/128"
          - "2400:52e0:1e00:2::1332:1/128"
          - "2400:52e0:1e00:2::1333:1/128"
          - "2400:52e0:1e00:2::1334:1/128"
          - "2400:52e0:1e01::879:1/128"
          - "2400:52e0:1e01::883:1/128"
          - "2400:52e0:1e01::1056:1/128"
          - "2400:52e0:1e01::1444:1/128"
          - "2400:52e0:1e01::1445:1/128"
          - "2400:52e0:1e02::946:1/128"
          - "2400:52e0:1e02::947:1/128"
          - "2400:52e0:1e02::951:1/128"
          - "2400:52e0:1e02::1072:1/128"
          - "2400:52e0:1e02::1073:1/128"
          - "2400:52e0:1e02::1074:1/128"
          - "2400:52e0:1e02::1187:1/128"
          - "2400:52e0:1e02::1214:1/128"
          - "2400:52e0:1e02::1215:1/128"
          - "2400:52e0:1e02::1216:1/128"
          - "2400:52e0:1e02::1217:1/128"
          - "2400:52e0:1e02::1218:1/128"
          - "2400:52e0:1e02::1219:1/128"
          - "2400:52e0:1e02::1220:1/128"
          - "2400:52e0:1e02::1221:1/128"
          - "2400:52e0:1e02::1273:1/128"
          - "2400:52e0:1e02::1315:1/128"
          - "2400:52e0:1e02::1316:1/128"
          - "2400:52e0:1e02::1317:1/128"
          - "2400:52e0:1e02::1318:1/128"
          - "2400:52e0:1e02::1319:1/128"
          - "2400:52e0:1e02::1320:1/128"
          - "2400:52e0:1e02::1321:1/128"
          - "2400:52e0:1e02::1323:1/128"
          - "2400:52e0:1e02::1324:1/128"
          - "2400:52e0:1e02::1325:1/128"
          - "2400:52e0:1e02::1326:1/128"
          - "2400:52e0:1e02::1327:1/128"
          - "2400:52e0:1e02::1349:1/128"
          - "2400:52e0:1e02::1350:1/128"
          - "2400:52e0:1e03::1205:1/128"
          - "2400:52e0:1e03::1312:1/128"
          - "2400:52e0:1e03::1443:1/128"
          - "2400:52e0:1e04::888:1/128"
          - "2400:52e0:1e04::1202:1/128"
          - "2400:52e0:1e04::1432:1/128"
          - "2400:52e0:1e04::1433:1/128"
          - "2400:52e0:1e05::887:1/128"
          - "2400:52e0:1e05::1204:1/128"
          - "2400:52e0:1e06::895:1/128"
          - "2400:52e0:1e06::1446:1/128"
          - "2400:52e0:1e07::1161:1/128"
          - "2400:52e0:1e08::1046:1/128"
          - "2400:52e0:1e09::889:1/128"
          - "2401:3bc0:b:21::2/128"
          - "2401:c080:1c01:5a:ba3f:d2ff:fe0a:94b0/128"
          - "2404:f780:0:2::d/128"
          - "2404:f780:0:2::f/128"
          - "2404:f780:0:2::11/128"
          - "2404:f780:0:2::13/128"
          - "2404:f780:0:2::15/128"
          - "2404:f780:5:cafe::13/128"
          - "2405:5700:1:380::1436:1/128"
          - "2602:ffe4:c09:106::1154/128"
          - "2602:ffe4:c54:277::ff/128"
          - "2607:5300:20e:a100::/128"
          - "2607:f2d8:4010:5b::1358:1/128"
          - "2607:fdc0:1:5:3eec:efff:fee1:95b3/128"
          - "2800:1e0:c01:a003::8/128"
          - "2800:1e0:2410:1::9/128"
          - "2a01:4f8:10a:201f::2/128"
          - "2a01:4f8:120:5193::2/128"
          - "2a01:4f8:120:71ae::2/128"
          - "2a01:4f8:162:3029::2/128"
          - "2a01:4f8:162:3148::2/128"
          - "2a01:4f8:172:2217::2/128"
          - "2a01:4f8:190:6405::2/128"
          - "2a01:4f8:191:74ec::2/128"
          - "2a01:4f8:192:c4::2/128"
          - "2a01:4f8:201:122f::2/128"
          - "2a01:4f8:201:4425::2/128"
          - "2a01:4f8:211:29a1::2/128"
          - "2a01:4f8:212:a19::2/128"
          - "2a01:4f8:212:a46::2/128"
          - "2a01:4f8:222:556::2/128"
          - "2a01:4f8:222:2a05::2/128"
          - "2a01:4f8:c17:fc7::1/128"
          - "2a01:4f8:c17:20b2::1/128"
          - "2a01:4f8:c17:aec0::1/128"
          - "2a01:4f9:3070:3934::2/128"
          - "2a01:6ee0:30:c::1127:1/128"
          - "2a02:6ea0:c113:2::1364:1/128"
          - "2a02:6ea0:c454::1/128"
          - "2a02:6ea0:c454::2/128"
          - "2a02:6ea0:d70d:1::919:1/128"
          - "2a02:6ea0:e009::893:1/128"
          - "2a02:6ea0:e605:1::915:1/128"
          - "2a02:6ea0:f904::1163:1/128"
          - "2a04:ff07:d9:1::1/128"
          - "2a04:ff07:d9:3::1/128"
          - "2a04:ff07:d9:12::1/128"
          - "2a04:ff07:d9:13::1/128"
          - "2a04:ff07:d9:1b::1/128"
          - "2a04:ff07:d9:39::1/128"
          - "2a04:ff07:d9:3a::1/128"
          - "2a04:ff07:d9:3b::1/128"
          - "2a0b:21c0:2000:208f::ff/128"
          - "2a0d:5600:1a:26::2/128"
  1. Add the trusted IPs to the entrypoints.

Underneath the entryPoints configuration in the same file (traefik_config.yml), make sure the web and websecure entrypoints reference the new trusted IPs. Your configuration should look like this:

entryPoints:
  web:
    address: ":80"
    forwardedHeaders: # Important
      trustedIPs: *trustedIPs # Important
  websecure:
    address: ":443"
    forwardedHeaders: # Important
      trustedIPs: *trustedIPs # Important

Restart the containers

We’re almost finished! Go to where the docker-compose.yml file is for Pangolin, and restart the stack with these commands:

sudo docker compose down && sudo docker compose up -d --force-recreate

Note

Please note that the X-Real-IP header should now be the correct client IP, but BunnyCDN’s IPs will still show under “Logs & Analytics” > “HTTP Request Logs” in the Pangolin UI. You may ignore this as it is simply cosmetic.

Conclusion

All your applications should now see the correct client IP!

If you forward some Pangolin services to a local Traefik instance running at home, for example, follow the section Traefik Trusted IPs for your local Traefik instance.

Have a great day.