Merge pull request #237 from linuxserver/swag-cloudflare-real-ip-update

Attempt to prevent race conditions
This commit is contained in:
Roxedus
2021-08-23 22:30:41 +02:00
committed by GitHub
+3 -5
View File
@@ -2,10 +2,8 @@
# shellcheck shell=bash
# shellcheck disable=SC2046
printf "set_real_ip_from %b;\n" $({
curl -s -w '\n' "https://www.cloudflare.com/ips-v4" &
curl -s -w '\n' "https://www.cloudflare.com/ips-v6" &
ip route | grep -v default | awk '{print $1}'
}) > /config/nginx/cf_real-ip.conf
printf "set_real_ip_from %b;\n" $(curl -s "https://www.cloudflare.com/ips-v4") > /config/nginx/cf_real-ip.conf
printf "set_real_ip_from %b;\n" $(curl -s "https://www.cloudflare.com/ips-v6") >> /config/nginx/cf_real-ip.conf
printf "set_real_ip_from %b;\n" $(ip route | grep -v default | awk '{print $1}') >> /config/nginx/cf_real-ip.conf
chown abc:abc /config/nginx/cf_real-ip.conf