mirror of
https://github.com/TrezOne/docker-mods-uptime-kuma-timeout-fix.git
synced 2026-07-13 15:11:19 -04:00
19 lines
690 B
Plaintext
19 lines
690 B
Plaintext
#!/usr/bin/with-contenv bash
|
|
# shellcheck shell=bash
|
|
|
|
echo "set_real_ip_from 127.0.0.1;" >/config/nginx/cf_real-ip.conf
|
|
|
|
ip route | grep -v default | awk '{print $1}' | while IFS= read -r line; do
|
|
echo "set_real_ip_from ${line};" >>/config/nginx/cf_real-ip.conf
|
|
done
|
|
|
|
curl -s "https://api.cloudflare.com/client/v4/ips" | jq -r '.result.ipv4_cidrs[]' | while IFS= read -r line; do
|
|
echo "set_real_ip_from ${line};" >>/config/nginx/cf_real-ip.conf
|
|
done
|
|
|
|
curl -s "https://api.cloudflare.com/client/v4/ips" | jq -r '.result.ipv6_cidrs[]' | while IFS= read -r line; do
|
|
echo "set_real_ip_from ${line};" >>/config/nginx/cf_real-ip.conf
|
|
done
|
|
|
|
chown abc:abc /config/nginx/cf_real-ip.conf
|