workers-sdk
workers-sdk copied to clipboard
fix(miniflare): bypass proxy for local inspector connections
Fixes #8906
When users have proxy environment variables set (HTTP_PROXY, HTTPS_PROXY, etc.), the local development server fails to start with a "TypeError: fetch failed" error.
Root cause
- Wrangler detects proxy environment variables and sets a global ProxyAgent
- Miniflare's InspectorProxyController makes a fetch request to
127.0.0.1to connect to the workerd inspector - This local request incorrectly goes through the proxy, which typically cannot handle localhost addresses, causing the connection to fail
Solution
Modified InspectorProxyController.updateConnection() to use a dedicated
Agent for the local fetch request, bypassing the global proxy settings.
Local inspector connections should never be proxied.
- Tests
- [ ] Tests included/updated
- [x] Tests not necessary because: Tested locally with proxy environment variables set
- Public documentation
- [ ] Cloudflare docs PR(s):
- [x] Documentation not necessary because: This should be defalut behavior
- Wrangler V3 Backport
- [ ] Wrangler PR:
- [x] Not necessary because: Not a patch change, not a Wrangler change
🦋 Changeset detected
Latest commit: cd09cfe9823b9a7f2d87bff80907b607c91ed95e
The changes in this PR will be included in the next version bump.
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR