You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[PR] fix(launcher): bypass loopback proxying for claude and unwrap absolute /bili/ URLs - #2746
Fixes an HTTP 403 tunnel_destination_denied ("the bili tunnel may not target the proxy itself") error when launching Claude Code via bili claude.
Root Cause
Missing NO_PROXY in ENV_CLIENTS.claude: bili claude sets HTTPS_PROXY (for cert-MITM) and ANTHROPIC_BASE_URL (loopback rewrite to http://127.0.0.1:<port>/bili/https://api.anthropic.com). Without LAUNCHER_LOOPBACK_NO_PROXY, Claude's HTTP client (undici/EnvHttpProxyAgent) treats the loopback target as a proxied destination, emitting absolute-form HTTP requests (POST http://127.0.0.1:<port>/bili/... HTTP/1.1).
Absolute-form /bili/ URL handling in resolveUpstream: resolveUpstream checked reqUrl.startsWith("/bili/"), failing to match absolute-form URLs (http://127.0.0.1:<port>/bili/...) and falling through to the general forward-proxy handler. This set upstream to the proxy itself (http://127.0.0.1:<port>), which checkTunnelDestination Layer 1 rejected with 403.
Changes
src/launcher.ts: Injected LAUNCHER_LOOPBACK_NO_PROXY (localhost,127.0.0.1,::1) into ENV_CLIENTS.claude via extras, aligning it with qwen, jcode, aider, and zed.
src/server.ts: Normalized incoming URLs in resolveUpstream so absolute URLs targeting /bili/ unwrap the embedded upstream path instead of proxying to the local host.
tests/launcher.test.ts: Added assertions verifying NO_PROXY and no_proxy in buildClaudeEnv.
tests/zero-config-routing.test.ts: Added unit tests for absolute-form /bili/ URLs (with/without query parameters and explicit protocols) and standard forward-proxy URLs.
ranxianglei
changed the title
fix(launcher): bypass loopback proxying for claude and unwrap absolute /bili/ URLs
[PR] fix(launcher): bypass loopback proxying for claude and unwrap absolute /bili/ URLs
Oct 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes an HTTP 403
tunnel_destination_denied("the bili tunnel may not target the proxy itself") error when launching Claude Code viabili claude.Root Cause
NO_PROXYinENV_CLIENTS.claude:bili claudesetsHTTPS_PROXY(for cert-MITM) andANTHROPIC_BASE_URL(loopback rewrite tohttp://127.0.0.1:<port>/bili/https://api.anthropic.com). WithoutLAUNCHER_LOOPBACK_NO_PROXY, Claude's HTTP client (undici/EnvHttpProxyAgent) treats the loopback target as a proxied destination, emitting absolute-form HTTP requests (POST http://127.0.0.1:<port>/bili/... HTTP/1.1)./bili/URL handling inresolveUpstream:resolveUpstreamcheckedreqUrl.startsWith("/bili/"), failing to match absolute-form URLs (http://127.0.0.1:<port>/bili/...) and falling through to the general forward-proxy handler. This setupstreamto the proxy itself (http://127.0.0.1:<port>), whichcheckTunnelDestinationLayer 1 rejected with 403.Changes
src/launcher.ts: InjectedLAUNCHER_LOOPBACK_NO_PROXY(localhost,127.0.0.1,::1) intoENV_CLIENTS.claudeviaextras, aligning it withqwen,jcode,aider, andzed.src/server.ts: Normalized incoming URLs inresolveUpstreamso absolute URLs targeting/bili/unwrap the embedded upstream path instead of proxying to the local host.tests/launcher.test.ts: Added assertions verifyingNO_PROXYandno_proxyinbuildClaudeEnv.tests/zero-config-routing.test.ts: Added unit tests for absolute-form/bili/URLs (with/without query parameters and explicit protocols) and standard forward-proxy URLs.