feat(api-proxy): replace Node.js proxy with nginx#829
feat(api-proxy): replace Node.js proxy with nginx#829Claude wants to merge 2 commits intoclaude/enable-api-proxy-by-defaultfrom
Conversation
Replace the Node.js-based API proxy with nginx for better performance and reliability. Key changes: - Replace Express/http-proxy-middleware with nginx reverse proxy - Add support for both OpenAI (port 10000) and Anthropic (port 10001) APIs - Inject API keys via Authorization headers using entrypoint script - Pass ANTHROPIC_API_KEY to api-proxy container - Set ANTHROPIC_BASE_URL in agent when Anthropic key is provided - Exclude ANTHROPIC_API_KEY from agent environment when proxy enabled - Use sed-based variable substitution (no external dependencies) The nginx implementation provides the same functionality as the Node.js version while being more lightweight and following industry-standard patterns for API gateways. Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
|
Chroot tests passed! Smoke Chroot - All security and functionality tests succeeded. |
|
📰 VERDICT: Smoke Copilot has concluded. All systems operational. This is a developing story. 🎤 |
|
💫 TO BE CONTINUED... Smoke Claude failed! Our hero faces unexpected challenges... |
Bun Build Test Results
Overall: PASS ✅ All tests completed successfully with Bun v1.3.9.
|
|
Smoke Test Results ✅ GitHub MCP: Retrieved last 2 merged PRs (#827, #826) Overall: PASS cc:
|
Build Test: Deno ✅
Overall: PASS All Deno tests passed successfully.
|
Node.js Build Test Results ✅All projects successfully installed dependencies and passed tests.
Overall: ✅ PASS
|
Go Build Test Results
Overall: PASS ✅ All Go projects built and tested successfully.
|
Build Test: Rust Results
Overall: PASS ✅ All Rust projects built and tested successfully.
|
Java Build Test Results
Overall: PASS ✅ All Java projects compiled successfully and tests passed through the AWF firewall with Maven proxy configuration.
|
.NET Build Test Results
Overall: PASS ✅ All .NET projects successfully restored, built, and ran with expected output.
|
Chroot Version Comparison Test Results
Overall Result: ❌ Tests FAILED Python and Node.js versions differ between host and chroot environments. Only Go versions match correctly.
|
Replaces the Node.js-based API proxy with nginx to provide better performance and enable proper support for both OpenAI and Anthropic APIs through the firewall.
Changes
Replaced Express/http-proxy-middleware with nginx reverse proxy
Authorization: Bearer ${OPENAI_API_KEY}x-api-key: ${ANTHROPIC_API_KEY}Fixed Anthropic API key handling
ANTHROPIC_BASE_URL=http://172.30.0.30:10001in agent environmentUpdated docker-manager.ts
openaiApiKeyoranthropicApiKeyis providedImplementation
The nginx configuration routes all traffic through Squid to respect domain whitelisting while injecting authentication tokens:
Both proxies maintain the same security model: API keys remain isolated in the sidecar container and are never exposed to the agent.