Repository navigation
Conversation
`proxyAwareFetch` applied HTTP_PROXY/HTTPS_PROXY, and a connection-level proxy, to every target — loopback included. A proxy resolves `localhost` against its own machine, so once those variables are set (the normal state on a corporate Windows box) a local provider can never be reached: the executor sees a connection error, `markAccountUnavailable` records "Provider error", and the model is locked for 30 s. That also matches the evidence in the report: `curl` and a bare `fetch()` in Node both reached Ollama, because Node's fetch ignores the proxy environment entirely. Only 9router applied it. `isLoopbackTarget` covers localhost and *.localhost, 127.0.0.0/8, ::1, and IPv4-mapped loopback in both spellings — `new URL()` re-serializes `[::ffff:127.0.0.1]` as `::ffff:7f00:1`, so matching only the dotted form would miss the value actually seen. The bypass stops at loopback: a remote Ollama on a LAN address can legitimately need the proxy, and NO_PROXY still covers that. Fixes decolua#3424
rabbi696
pushed a commit
to golamrabbi696/EzRouter
that referenced
this pull request
Aug 24, 2026
This was referenced Aug 26, 2026
port(upstream): #3517 - never send loopback requests through the outbound proxy
bloodf/durindoor#606
Closed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #3424.
Root cause
proxyAwareFetchresolves a proxy for every target —HTTP_PROXY/HTTPS_PROXYfrom the environment, or a connection-level proxy — with noloopback exemption.
NO_PROXYis honoured, but nothing sets it by default.An outbound proxy resolves
localhostagainst its own machine, so a requestto
http://localhost:11434/api/chatcannot succeed through one. The executorsees a connection error,
markAccountUnavailablewritestestStatus: "unavailable"with the generic"Provider error", and the model is locked for30 s — exactly the reported behaviour, including the re-locking after clearing
locks by hand.
This also explains the reporter's evidence, which otherwise looks contradictory:
curl http://localhost:11434/api/tagsfetch()in plain NodeproxyFetchThe connection test passes for the same reason it is a different code path in
their setup, so the dashboard shows a healthy account whose requests all fail.
Change
isLoopbackTarget(url)(exported for tests) short-circuits both proxyresolvers — the environment one and the connection one.
Covered:
localhostand*.localhost, all of127.0.0.0/8,::1(and itsexpanded form), and IPv4-mapped loopback in both spellings —
new URL()re-serializes
[::ffff:127.0.0.1]as::ffff:7f00:1, so matching only thedotted form would miss the value actually seen at runtime.
Deliberately not covered: LAN and CGNAT ranges. A remote Ollama at
192.168.1.10can legitimately need the proxy, andNO_PROXYalready handlesthat case. Look-alike hosts (
localhost.evil.com,127.0.0.1.evil.com) arepinned as still-proxied by tests.
Scope
This is the connectivity half of the report. The issue's suggestion 2 — that
markAccountUnavailablecollapses a non-string error into the generic"Provider error"and loses the diagnostics — is real and I have it as a separatechange, since it affects every provider rather than just this one. Suggestion 1
(a
/healthprobe) does not appear in the current source:ollama-local'sconnection test uses
GET {baseUrl}/api/tags, which is what the reporter measuredas working.
Tests
tests/unit/loopback-proxy-bypass-3424.test.js(new, 18 cases): the predicateacross loopback spellings and non-loopback look-alikes, plus two behavioural
cases that import the module with
globalThis.fetchstubbed and assert no proxydispatcher is attached — one with
HTTP_PROXYset, one with a connection-levelproxy.
Mutation check — removing both guards fails exactly the two behavioural cases:
npx eslintclean on both changed files.