Linux Lab · · Approx. 19 min read

Hugging Face Downloads Stuck? Route HF and CDN Domains in Clash (2026)

Pulling model weights, datasets, or tokenizer files through huggingface_hub, git lfs, or the website should feel boring. When it instead turns into endless retries, TLS handshakes that never finish, or speeds that collapse to zero, the culprit is often not “Python is slow”—it is split routing: metadata hits one path, CDN blobs another, and your DNS stack disagrees with what Clash (or mihomo) thinks the hostname meant. This guide maps the Hugging Face surfaces you actually need to policy together, shows how to place rules ahead of blunt GEOIP catch-alls, and walks fake-ip alignment so model downloads stop fighting your proxy. It complements chat-centric posts: here the workload is bytes on the wire, not streaming tokens from a dialog API.

1. Why Downloads Stall Behind a Split-Tunnel Profile

A typical Clash profile sends “foreign” sites to a proxy group and everything else DIRECT. Hugging Face traffic rarely behaves like a single hostname. The Hub API and HTML may resolve cleanly, while large artifacts ride CDN hostnames that your subscription never mentioned. If those hosts fall through to GEOIP or a default that prefers direct egress, you observe classic failure modes: the UI renders, huggingface-cli download starts, then byte throughput dies mid-stream; git lfs prints cryptic HTTP errors; or TLS fails because the client and resolver disagree about where the CDN edge lives.

Another common trap is treating model download issues like ChatGPT or IDE assistant outages. Conversational APIs usually hinge on a narrow set of domains and long-lived HTTPS connections. Bulk file retrieval instead looks like parallel TCP sessions, HTTP redirects, occasional HTTP/3, and resumable ranges—precisely the pattern that exposes weak rule order, partial TUN capture, or DNS modes that return synthetic addresses. Fixing HF is closer to tuning game or app store CDN rules than to pasting a chat domain list, which is why we draw parallels to large binary pipelines elsewhere on this site.

Keep expectations realistic: Clash cannot invent bandwidth your upstream lacks. It can, however, stop you from accidentally pinning multi-gigabyte transfers to a congested or policy-incompatible path because half of the request chain never matched the proxy group you assumed was “global enough.”

2. Hub, Short Links, and CDN Surfaces to Name Explicitly

Start from stable suffixes rather than chasing ephemeral IP lists. In most setups you want DOMAIN-SUFFIX,huggingface.co and DOMAIN-SUFFIX,hf.co in the same policy group as your trusted exit for Hub operations. The shorter hf.co namespace matters because documentation, shared links, and redirects often use it even when the mental model says “huggingface.co”. Skipping it is an easy way to strand one half of a redirect chain on DIRECT.

Large file transfers frequently touch dedicated LFS or CDN labels such as cdn-lfs.huggingface.co (naming can evolve—treat concrete hostnames you see in logs as ground truth). The important operational idea is that these are not interchangeable with the main site certificate you already trust in the browser; they still need to match the same routing intent. If your profile proxies the landing page but leaves the CDN host on a default path, you get the “starts fast, then hangs” symptom as the client switches endpoints.

If you mirror public models inside a company, internal mirrors deserve their own explicit rows—do not rely on wildcard imagination. For upstream Hugging Face pulls, also consider ancillary fetches: authentication endpoints if you use tokens, optional telemetry hosts if your security team blocks them, and any package indexes you combine with HF workflows (PyPI mirrors are a separate story, but mixed installs fail confusingly when only half the stack is routed). When in doubt, capture five minutes of live mihomo logs while reproducing a stalled model download; the host column is more reliable than a static list from last year’s gist.

3. Mihomo Rules: Order, Snippets, and Policy Groups

Place explicit Hugging Face rows above broad GEOIP or region shortcuts. Meta cores resolve rules top-down; the first match wins. A lazy “CN direct, everything else proxy” design only works if every hostname you care about is either Chinese or explicitly listed. CDN edges for HF may geolocate unexpectedly relative to your mental map, so do not assume the GEOIP bucket tells the whole story for blob traffic.

Example: minimal explicit rows (adjust policy name)

# Place these BEFORE catch-all GEOIP / MATCH rules
rules:
  - DOMAIN-SUFFIX,huggingface.co,PROXY-HF
  - DOMAIN-SUFFIX,hf.co,PROXY-HF
  - DOMAIN-SUFFIX,cdn-lfs.huggingface.co,PROXY-HF
  # ... subscription-specific lists continue here ...

Map PROXY-HF to the same nested selector you already use for other critical developer traffic, or carve a dedicated group if you want to pin large downloads to a node that tolerates long sessions. Avoid duplicating contradictory rows in rule-providers and inline rules unless you track ordering carefully—our rule-providers and GEOIP maintenance guide explains how stale provider files silently undo your intent.

If you maintain a shared team template, document why split-tunnel rules for HF exist separately from entertainment or streaming lists. Nothing confuses newcomers faster than a “global” profile that was actually optimized for video sites while developer CDN bytes still miss the tunnel. For broader pattern thinking, our advanced routing guide walks precedence and policy design without locking you into one vendor’s YAML dialect.

4. DNS, Fake-IP, and Resolver Modes

DNS is half of routing. With fake-ip enabled, clients may receive synthetic addresses that only make sense once traffic reaches Clash. That is powerful for domain-based policies, but it demands consistency: the resolver that answers your workstation, the language runtime pulling model weights, and the tunnel core must agree on who owns DNS. If a Python process bypasses the tunneled resolver while the browser uses it, you will chase ghosts—timeouts that look like packet loss but are mismatched IP worlds.

Practical checks: query the same hostname from the shell and from a tool you trust on the host, then compare answers and whether mihomo logs show the expected policy for the resulting flow. When experimenting, temporarily log at debug verbosity and look for the HF-related domains; if they never appear, traffic never entered the core—fix interfaces and resolver forwarding before rewriting rules. For Windows subscription health adjacent to DNS weirdness, subscription TLS and DNS troubleshooting covers the host-side half of that story.

IPv6 paths deserve an explicit mention. If your OS prefers AAAA records but your proxy path is IPv4-only or differently routed, large downloads may try the wrong family first and stall. Aligning dual-stack behavior—either consistently through the tunnel or consistently disabled for testing—reduces “works in browser, fails in CLI” reports that are actually address-family races.

5. huggingface-cli, Git LFS, and pip Versus the Browser

The browser might succeed while huggingface-cli fails because the two stacks reuse different trust stores, proxy environment variables, or DNS APIs. On macOS and Linux, terminal sessions often inherit a smaller subset of system proxy settings than GUI apps; on Windows, the reverse can happen if WSL or containers enter the picture. Standardize on one approach: either explicit HTTP_PROXY/HTTPS_PROXY for CLI tools aligned with your mixed-port, or pure TUN capture verified with logs—mixing without intention duplicates failure modes.

git lfs adds another layer: LFS batch URLs may differ from the Git remote you cloned. Routing only github.com is insufficient when your remote is HF-hosted; conversely, routing HF without Git’s HTTP stack configured still breaks. If you run pulls inside Docker, revisit bridge networking and env propagation—our Docker-through-host-Clash article walks the pattern of pushing container egress through the host proxy deliberately rather than hoping defaults align.

pip and conda installs that combine wheels with HF assets are especially noisy: one half of the job may hit a domestic mirror while the other chases international CDN edges. When diagnosing, isolate variables—download a small public model shard with the CLI alone, confirm stability, then reintroduce packaging layers. That sequencing keeps blame attached to the layer that actually changed.

6. TLS, SNI, QUIC, and When Sniffer Matters

HTTPS hides hostnames from naive observers; Clash Meta can recover information via Sniffer when needed, but domain rules still work most cleanly when connections are formed in ways your profile expects. If HTTP/3 (QUIC) bypasses a path where only TCP proxying was configured, symptoms look like random stalls as clients upgrade transports. Many teams temporarily prefer TCP/TLS for debugging—turn QUIC off in the browser, pin tools to HTTP/2, prove stability, then re-enable thoughtfully.

When TLS errors cite certificate names or handshake timeouts, distinguish censorship from misrouting. A policy that sends HF CDN traffic through an incompatible middlebox can surface as TLS failure even when plain browsing works. Collect evidence: exact hostname from logs, cipher negotiation stage, and whether disabling Sniffer changes outcomes (some enterprise MITM stacks interact poorly with sniffed flows). For deeper HTTPS debugging on Meta cores, our sniffer and SNI walkthrough explains how to read the evidence instead of guessing.

Compared with streaming or game CDN articles, HF workloads skew toward long CPU-light sockets—more similar to big binary fetches than to chat APIs. The Steam store and CDN routing piece illustrates how split endpoints behave when a storefront and a content delivery network disagree; the domain names differ, but the debugging rhythm—list hosts, order rules, verify DNS—is the same family of work.

7. Troubleshooting in a Fixed Order

Random toggles waste time. Walk this sequence when Hugging Face model downloads misbehave behind Clash:

If every box passes and performance is still poor, the honest conclusion may be upstream congestion or an exit node unsuitable for large sustained pulls—switch nodes methodically rather than flipping every advanced toggle at once.

8. Closing Thoughts

Routing Hugging Face well is an exercise in naming all the participants in a large transfer: Hub metadata, LFS or CDN blob hosts, your chosen mihomo policy group, and the DNS mode that makes domain rules meaningful. Compared with advice that stops at “turn on global mode,” explicit lists plus ordered rules give you logs you can defend in a postmortem—which is what engineering teams actually need when a fine-tune job stalls hours before a deadline.

This topic also stays deliberately distinct from chat-only AI posts: you are not chasing conversational API hosts; you are securing throughput and reliability for artifact pipes that power training and evaluation workflows. Treat it like any other CDN-heavy pipeline—observe hostnames, align split-routing decisions with resolver reality, and prefer reproducible steps over superstition.

When you want a maintained client build, clear installers, and room to grow into Meta-era features without hunting scattered binaries, start from our download center before you tune another YAML snippet. Compared with opaque one-off tools, open-core Clash distributions paired with visible rules tend to age better as both HF and your network evolve. → Download Clash for free and experience the difference

Hand-picked deep-dives on the same topic — practical Clash routing guides in the same category.