Skip to content

Instantly share code, notes, and snippets.

@kotx
Created August 3, 2022 04:05
Show Gist options
  • Save kotx/f0500e9f4d2c9a4c64a642fe548c430e to your computer and use it in GitHub Desktop.
Save kotx/f0500e9f4d2c9a4c64a642fe548c430e to your computer and use it in GitHub Desktop.
Add trusted Cloudflare IPs to a Caddyfile you can import
localhost {
import /include/cloudflare-proxies
}
#!/bin/bash
set -e -o pipefail
TARGET_FILE="/include/cloudflare-proxies"
IP4=$(curl -s https://www.cloudflare.com/ips-v4)
IP6=$(curl -s https://www.cloudflare.com/ips-v6)
cat << EOF | tee $TARGET_FILE
# Do NOT modify this file manually! It will be overwritten at a regular interval by ${BASH_SOURCE}!
trusted_proxies $(echo $IP4 $IP6 | xargs)
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment