diff --git a/docker-compose.yml b/docker-compose.yml index 8d2cb69..ce7a7b4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -73,3 +73,10 @@ networks: external: true egress: driver: bridge + # Without this, Docker still gives this network a NAT route to the + # public internet (every bridge network gets one by default, "default" + # isn't special) - which defeats the whole point. internal: true means + # nothing on this network, including sde-meeting-toolkit, has any route + # out except through egress-proxy, which also sits on "default" and IS + # meant to have one. + internal: true diff --git a/egress-proxy/tinyproxy.conf b/egress-proxy/tinyproxy.conf index 9a27280..4bdb143 100644 --- a/egress-proxy/tinyproxy.conf +++ b/egress-proxy/tinyproxy.conf @@ -5,7 +5,7 @@ # other outbound request from the app is refused here, not just unrouted, # so a compromised app container still can't reach anything else. User nobody -Group nogroup +Group nobody Port 8888 diff --git a/server.js b/server.js index b0d5fb8..34804aa 100644 --- a/server.js +++ b/server.js @@ -341,7 +341,12 @@ function proxyToClaude(req, res, user) { } } } catch (err) { - sendJson(res, 502, { error: 'Could not reach the Anthropic API: ' + err.message }); + // undici's fetch wraps the real reason in a generic "fetch failed" + // TypeError, with the actual cause one level down in err.cause. + // Surface both, or "fetch failed" alone tells you nothing. + const detail = err.cause ? (err.message + ' - ' + err.cause.message) : err.message; + console.error('Anthropic API call failed:', detail); + sendJson(res, 502, { error: 'Could not reach the Anthropic API: ' + detail }); } }); }