Commit eec2739
fix: bypass Squid for network gateway to fix MCP SSE crash (#553)
* fix: bypass Squid for network gateway to fix MCP SSE crash
Squid crashes with a segfault (comm.cc:1583 assertion failure) when
proxying concurrent MCP Streamable HTTP (SSE) connections from Codex
to the MCP gateway.
Root cause: Codex resolves host.docker.internal to 172.30.0.1 (the AWF
network gateway) instead of 172.17.0.1 (Docker bridge). The existing
iptables bypass only covers 172.17.0.1, so traffic to 172.30.0.1:80
gets DNAT-redirected to Squid, which crashes on concurrent SSE streams.
Fix: Dynamically detect the container's default network gateway via
`route -n` and add it to the iptables bypass list alongside
host.docker.internal, so MCP gateway traffic goes directly to the host.
Locally reproduced: before fix Squid crashes with the exact CI error;
after fix all SSE+POST traffic bypasses Squid and Squid stays alive.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: restrict network gateway bypass to TCP port 80 only
Address security review: narrow the OUTPUT ACCEPT rule from all
ports/protocols to only TCP port 80 (where MCP gateway runs).
The NAT RETURN rule remains broad since DNAT only catches 80/443.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 659bb9c commit eec2739
1 file changed
Lines changed: 11 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
136 | 147 | | |
137 | 148 | | |
138 | 149 | | |
| |||
0 commit comments