Trust the active Docker network gateway

This commit is contained in:
2026-08-25 09:08:26 +00:00
parent a84a17df41
commit 1c037aca58
4 changed files with 8 additions and 9 deletions
+2 -2
View File
@@ -3,9 +3,9 @@
set -eu
if [ "${TRUST_HOST_PROXY:-0}" = "1" ]; then
proxy_ip="$(getent ahostsv4 host.docker.internal | sed -n '1{s/[[:space:]].*//;p;}')"
proxy_ip="$(ip -4 route show default | sed -n 's/^default via \([^ ]*\).*/\1/p' | head -n 1)"
if [ -z "$proxy_ip" ]; then
echo "Cannot resolve the trusted Docker host gateway." >&2
echo "Cannot determine the trusted Docker network gateway." >&2
exit 1
fi
export FORWARDED_ALLOW_IPS="127.0.0.1,$proxy_ip"