feat(api): proxyUrl for residential/custom proxy egress on the API block#5867
Conversation
…I block The HTTP/API block egresses from the app runtime's fixed datacenter IPs via secureFetchWithPinnedIP, so targets behind Cloudflare/WAF that block datacenter IPs (e.g. state .gov license portals) return 403/429 even when the identical request works from a browser. There was no way to route a request through a residential/custom proxy. Add an optional `proxyUrl` field (Advanced) to the API block. When set, the request routes through the given http:// proxy so it egresses from that proxy's IP. Security: - validateAndPinProxyUrl resolves the proxy host's DNS and blocks private/reserved/loopback IPs (same SSRF guard as target URLs), then pins the connection by rewriting the host to the resolved IP (creds/port preserved), closing the DNS-rebinding window. - Restricted to the http: proxy scheme (https/socks rejected) so host pinning is safe without breaking TLS-to-proxy SNI. - Target-IP pinning is intentionally bypassed when a proxy is active (the proxy resolves the target); target URL validation still runs. Threaded block field -> http tool param -> formatRequestParams -> executeToolRequest (validate + pin) -> secureFetchWithPinnedIP, which swaps its pinned Node agent for HttpsProxyAgent/HttpProxyAgent (keyed off target protocol) when proxyUrl is set.
…entials to env vars
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryHigh Risk Overview The value flows through the Docs cover the new Advanced field and recommend Reviewed by Cursor Bugbot for commit ec633dc. Configure here. |
Greptile SummaryThis PR adds custom HTTP proxy egress to the API block. The main changes are:
Confidence Score: 5/5This looks safe to merge.
Important Files Changed
Reviews (3): Last reviewed commit: "chore(api): tighten proxy-path inline co..." | Re-trigger Greptile |
…g the self-hosted rebinding gap
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit d9b9440. Configure here.
|
@cursor review |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit ec633dc. Configure here.

Summary
Supersedes #5865 (thanks @mzxchandra — your commit is carried here with attribution intact). Adds an optional Proxy URL field to the API block so a request can egress through a residential/custom
http://proxy, plus the docs the original PR was missing.validateAndPinProxyUrlenforceshttp://scheme, resolves the proxy host's DNS and blocks private/reserved/loopback/metadata IPs, then pins the connection by rewriting the host to the resolved IP (creds/port preserved) — closing the DNS-rebinding window. Target URLs are still validated withvalidateUrlWithDNS; only target-IP pinning is bypassed when a proxy is active (the proxy resolves the target). Redirects carry the pinned proxy URL through and every hop's target is still re-validatedsecureFetchWithPinnedIPswaps its pinned agent forHttpsProxyAgent/HttpProxyAgentkeyed off the target protocol (CONNECT tunnel for https targets, absolute-URI for http); target SNI/cert validation is unaffectedvisibility: 'user-only'); the internal-route branch ignores it; proxy validation re-runs on every retry attempt{{PROXY_URL}}env-var references (field placeholder/description updated to match)http-proxy-agent@7.0.2/https-proxy-agent@7.0.6were already resolved inbun.lockas transitive deps; only manifest references are addedType of Change
Testing
input-validation.test.ts,tools/index.test.ts,tools/utils.test.ts), including new coverage: scheme rejection (https/socks5), malformed URLs, private/metadata proxy hosts, IPv6 bracket pinning, creds/port preservation, pinned-URL passthrough tosecureFetchWithPinnedIP, and trim/omit semantics informatRequestParamscheck:api-validation:strictcleanChecklist