Created
August 3, 2022 04:05
-
-
Save kotx/f0500e9f4d2c9a4c64a642fe548c430e to your computer and use it in GitHub Desktop.
Add trusted Cloudflare IPs to a Caddyfile you can import
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
localhost { | |
import /include/cloudflare-proxies | |
} |
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
#!/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