SWAG-Real-IP: Fix bug if networking is not working

It would produce a malformed line, stopping nginx from running if it failed to curl the list
This commit is contained in:
Roxedus
2021-01-21 16:52:23 +01:00
parent e8c5c40968
commit c49baad276
2 changed files with 10 additions and 3 deletions
+3 -2
View File
@@ -4,7 +4,8 @@
printf "set_real_ip_from %b;\n" $({
curl -s "https://www.cloudflare.com/ips-v4" &
curl -s "https://www.cloudflare.com/ips-v6"
}) >/config/nginx/cf_real-ip.conf
curl -s "https://www.cloudflare.com/ips-v6" &
echo "$(ip route get 1 | sed -n 's/^.*src \([0-9.]*\) .*$/\1/p' | sed 's/\.[0-9]*$//')/16"
}) > /config/nginx/cf_real-ip.conf
chown abc:abc /config/nginx/cf_real-ip.conf