From 7810f6cba2f4fe591ccf5cfed38e9463381ed6ae Mon Sep 17 00:00:00 2001 From: "anthropic-code-agent[bot]" <242468646+Claude@users.noreply.github.com> Date: Fri, 13 Feb 2026 07:27:04 +0000 Subject: [PATCH 1/2] Initial plan From 4749cf3fb90f2b4c6e95c2bb832f3a89c1457146 Mon Sep 17 00:00:00 2001 From: "anthropic-code-agent[bot]" <242468646+Claude@users.noreply.github.com> Date: Fri, 13 Feb 2026 07:30:09 +0000 Subject: [PATCH 2/2] fix: simplify api-proxy iptables bypass condition The NAT bypass for api-proxy traffic was checking both AWF_ENABLE_API_PROXY and AWF_API_PROXY_IP, but this was too strict. When the HTTP_PROXY environment variable is set, HTTP clients will send requests through the proxy unless NO_PROXY is configured or iptables rules prevent it. The issue was that the NAT bypass required both flags, causing traffic to 172.30.0.30 (api-proxy) to be sent through Squid when it should go directly. Squid then blocked these requests because the IP address wasn't in the domain whitelist. The fix simplifies the condition to only check AWF_API_PROXY_IP, matching the pattern used for the OUTPUT FILTER ACCEPT rules (lines 285-289). This ensures that when AWF_API_PROXY_IP is set, traffic to that IP bypasses Squid at the NAT level, preventing HTTP clients from routing through the proxy regardless of HTTP_PROXY settings. Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com> --- containers/agent/setup-iptables.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/containers/agent/setup-iptables.sh b/containers/agent/setup-iptables.sh index fef48b198..9151574a1 100644 --- a/containers/agent/setup-iptables.sh +++ b/containers/agent/setup-iptables.sh @@ -127,12 +127,12 @@ fi echo "[iptables] Allow traffic to Squid proxy (${SQUID_IP}:${SQUID_PORT})..." iptables -t nat -A OUTPUT -d "$SQUID_IP" -j RETURN -# Bypass Squid for api-proxy when API proxy is enabled. +# Bypass Squid for api-proxy when API proxy IP is configured. # The agent needs to connect directly to api-proxy (not through Squid). # The api-proxy then routes outbound traffic through Squid to enforce domain whitelisting. # Architecture: agent -> api-proxy (direct) -> Squid -> internet # Use AWF_API_PROXY_IP environment variable set by docker-manager (172.30.0.30) -if [ -n "$AWF_ENABLE_API_PROXY" ] && [ -n "$AWF_API_PROXY_IP" ]; then +if [ -n "$AWF_API_PROXY_IP" ]; then if is_valid_ipv4 "$AWF_API_PROXY_IP"; then echo "[iptables] Allow direct traffic to api-proxy (${AWF_API_PROXY_IP}) - bypassing Squid..." # NAT: skip DNAT to Squid for all traffic to api-proxy @@ -140,8 +140,6 @@ if [ -n "$AWF_ENABLE_API_PROXY" ] && [ -n "$AWF_API_PROXY_IP" ]; then else echo "[iptables] WARNING: AWF_API_PROXY_IP has invalid format '${AWF_API_PROXY_IP}', skipping api-proxy bypass" fi -elif [ -n "$AWF_ENABLE_API_PROXY" ]; then - echo "[iptables] WARNING: AWF_ENABLE_API_PROXY is set but AWF_API_PROXY_IP is not set" fi # Bypass Squid for host.docker.internal when host access is enabled.