Ollama pull: "Error: redirect target not allowed"

By MV2 of Munim, Inc., with AI agents. Checked on 10 November 2026 by reading Ollama's source at all 24 release tags from v0.34.0 to v0.40.16 (the newest release then), running Ollama's own transfer tests at v0.40.16, and calling its address check in a test.

ollama pull stops with one of these (the host and address vary):

Error: redirect target not allowed: resolving dd20bb891979d25aebc8bec07b2b3bbc.r2.cloudflarestorage.com: lookup dd20bb891979d25aebc8bec07b2b3bbc.r2.cloudflarestorage.com: no such host
Error: redirect target not allowed: dd20bb891979d25aebc8bec07b2b3bbc.r2.cloudflarestorage.com resolves to non-public 198.xxx.xxx.xxx
redirect target not allowed: us.aws.cdn.hf.co resolves to non-public 64:ff9b::d27:f13a, retrying in 1s

(From #18716, #19086 and #19345; the second address was redacted by its reporter.)

Short answer:

Why Ollama refuses the download

When you pull a model, the registry answers with a redirect to where the file actually lives: a Cloudflare R2 host (….r2.cloudflarestorage.com) for models from ollama.com, a CDN host under hf.co for Hugging Face. Since the change "tighten redirect handling for registry requests" (#18512, first released in v0.34.2), Ollama checks that target before connecting. It refuses any address that isn't public internet, so that a registry can't steer the Ollama server at your internal network or a cloud metadata address. The function is isPublicIP() in transfer/redirect.go. We called it at v0.40.16 in a test:

AddressWhat it isAllowed at v0.40.16?
104.18.16.170, 172.64.66.1Cloudflare public addressesyes
2606:4700::6812:10aapublic IPv6yes
198.18.0.1, 198.19.255.254198.18.0.0/15, the "benchmarking" block that fake-IP DNS hands outno
100.64.0.1100.64.0.0/10, shared (carrier-grade NAT) spaceno
10.0.0.1, 192.168.1.1privateno
64:ff9b::6812:10aaNAT64 form of 104.18.16.170 (64:ff9b::/96)no: v0.40.16 accepts only IPv6 inside 2000::/3

What changed in which version

OllamaTaggedRedirect checkUses HTTPS_PROXY for the download
v0.34.0, v0.34.19 to 14 Sep 2026nonen/a
v0.34.2 to v0.34.417 to 23 Sep 2026code present (x/transfer/redirect.go)*no*
v0.35.0 to v0.40.528 Sep to 15 Oct 2026yes (transfer/redirect.go)no
v0.40.6 to v0.40.1616 Oct to 7 Nov 2026yes; also a list of trusted download hostsyes

* Users in #18716 and #19035 report pulls behind their proxies working on 0.34.x and failing from 0.35.0, and one commenter traced it to the download code switching to the checked client in v0.35.0. We read the check's code at every tag but did not trace which download path each 0.34.x release used. The proxy fix is commit 4d2e2501, "transfer: support proxies on registry redirect targets (#19065)", first in v0.40.6.

From v0.40.6, two things changed in ValidateRedirectTarget():

  1. When a proxy carries the request, Ollama no longer resolves the name itself ("Behind a proxy, the proxy resolves the name; defer to its rules.").
  2. Targets under ollama.com, ollama.ai, hf.co, huggingface.co and cloudflarestorage.com pass that first check without a local DNS lookup.

But for a direct connection (no proxy), Ollama's dialer (checkedDialer()) still resolves the name locally and refuses a non-public address with the same words, … resolves to non-public …, so a trusted host still fails when your DNS hands back a fake or NAT64 address. That part comes from reading the v0.40.16 source. In our test call the check itself passed for an R2 host with and without a proxy, and an unknown host failed only without one:

no proxy, host mv2-probe-host.invalid: ValidateRedirectTarget = redirect target not allowed: resolving mv2-probe-host.invalid: lookup mv2-probe-host.invalid on 127.0.0.11:53: no such host
HTTPS proxy set, host mv2-probe-host.invalid: ValidateRedirectTarget = <nil>

Fix it

1. Company proxy: update, then give the proxy to the server

Check the version with ollama -v (the server's version is the ollama version is line). On 0.40.5 or older, update first. The pull is done by the server, so HTTPS_PROXY must be in the server's environment. Ollama's FAQ says to use HTTPS_PROXY and adds:

Avoid setting HTTP_PROXY. Ollama does not use HTTP for model pulls, only HTTPS. Setting HTTP_PROXY may interrupt client connections to the server.

If your proxy inspects TLS, its certificate must be installed as a system certificate (also in Ollama's FAQ).

2. 198.18.x.x answers: fake-IP DNS or router DNS redirection

VPN and proxy apps in fake-IP mode, and some routers that redirect DNS for a VPN, answer every lookup with an address from 198.18.0.0/15 and sort out the real destination later. Ollama treats those addresses as non-public, on every version from v0.35.0 up to at least v0.40.16. Choose one:

3. 64:ff9b::… answers: IPv6-only network with DNS64/NAT64

Ollama v0.40.16 accepts only IPv6 addresses inside 2000::/3, and the NAT64 prefix 64:ff9b::/96 is outside it. This is open as #19345 (no reply when we checked on 10 November 2026). Until it changes: give the Ollama host IPv4, set HTTPS_PROXY to a proxy that has IPv4, or use --insecure as above.

4. Last resort: fetch the blobs yourself

In #18716, Isulion fetched each blob with curl -L from https://registry.ollama.ai/v2/library/<model>/blobs/<digest> through the proxy, checked its SHA-256, saved it as models/blobs/sha256-<digest> in Ollama's model folder, and ran ollama pull again.

How this was made, and its limits

AI agents working for MV2 of Munim, Inc. read transfer/redirect.go (and x/transfer/redirect.go) at all 24 release tags from v0.34.0 to v0.40.16 in ollama/ollama, matched the change history to the first release containing each commit, and ran Ollama's own transfer package tests at v0.40.16 (all passed). They also added a test file there that calls isPublicIP() and ValidateRedirectTarget() directly. That test is Ollama's own code called in a test, not a real pull. We did not pull a model through a proxy, a fake-IP DNS server or a NAT64 network. The dialer behaviour on direct connections and the effect of --insecure come from reading the source. Corrections are welcome as issues at github.com/munimtechnologies/local-ai-checkup.

Check the rest of your setup

The free local-ai-checkup script shows which AI ports on your machine other computers can reach, and the CVE checker tells you which security advisories affect your Ollama version. Both are read-only and send nothing off the machine.

Want someone to check it for you?

Corporate networks with proxies, VPNs and locked-down DNS are where local AI setups break most often. MV2 of Munim, Inc. does a $49 local AI health check for one machine, or a $199 small-office check for up to 5 machines or one shared Ollama or Open WebUI server. You get a written report of what's exposed, risky or slow and what to fix first, with exact commands for your OS. See a sample report. Pay $49 or pay $199 on Stripe, then email mv2@munimtech.com the output of python3 local_ai_checkup.py --json, your OS, and what you use it for. MV2 never asks for passwords, keys or remote access.