Skip to content

Commit 68cf2ff

Browse files
MichellehbnHugoch
andauthored
Update models-downloading with downloading behind a proxy or firewall… (#2628)
* Update models-downloading with downloading behind a proxy or firewall info * Update models-downloading.md Addresses comments from @rajatarya 💪 * Update docs/hub/models-downloading.md Co-authored-by: Hugo Larcher <hugo.larcher@huggingface.co> --------- Co-authored-by: Hugo Larcher <hugo.larcher@huggingface.co>
1 parent 82f1810 commit 68cf2ff

1 file changed

Lines changed: 48 additions & 0 deletions

File tree

docs/hub/models-downloading.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,51 @@ hf-mount start repo openai-community/gpt2 /tmp/gpt2
8282
```
8383

8484
Repos are mounted read-only. See [Mount as a Local Filesystem](./storage-buckets-access#mount-as-a-local-filesystem) for full setup details, backend options, and caching.
85+
86+
## Downloading behind a proxy or firewall
87+
88+
If your network restricts outbound traffic through a firewall or proxy, downloading models and datasets requires more than just `huggingface.co`. File contents are served from separate storage and CDN hostnames, and `from_pretrained` / `hf download` will fail if these are not reachable, even when `huggingface.co` itself is allowlisted.
89+
90+
Allowlist the following hostnames (all over HTTPS / port 443):
91+
92+
93+
| Hostname | Purpose |
94+
|-------------------------------|-------------------------------------------|
95+
| `huggingface.co` | Hub API, metadata, and download redirects |
96+
| `cas-server.xethub.hf.co` | Xet storage protocol APIs + upload (US) |
97+
| `cas-server.xethub-eu.hf.co` | Xet storage protocol APIs + upload (EU) |
98+
| `transfer.xethub.hf.co` | Xet storage download APIs (US) |
99+
| `transfer.xethub-eu.hf.co` | Xet storage download APIs (EU) |
100+
| `cas-bridge.xethub.hf.co` | Bridge CDN, legacy (US) |
101+
| `cas-bridge.xethub-eu.hf.co` | Bridge CDN, legacy (EU) |
102+
| `us.aws.cdn.hf.co` | CDN edge (US) |
103+
| `us.gcp.cdn.hf.co` | CDN edge (US) |
104+
| `cdn-lfs.hf.co` | LFS CDN, legacy (global) |
105+
| `cdn-lfs-us-1.hf.co` | LFS CDN (US) |
106+
| `cdn-lfs-eu-1.hf.co` | LFS CDN (EU) |
107+
| `cdn-lfs.huggingface.co` | LFS CDN, legacy (global) |
108+
| `cdn-lfs-us-1.huggingface.co` | LFS CDN, legacy (US) |
109+
| `cdn-lfs-eu-1.huggingface.co` | LFS CDN, legacy (EU) |
110+
111+
> [!TIP]
112+
> Downloads follow HTTP redirects from `huggingface.co` to these hostnames, so
113+
> allowlisting `huggingface.co` alone is not sufficient. A `ReadTimeoutError` (rather than
114+
> a connection error) partway through a download usually means the initial connection
115+
> succeeded but a storage or CDN host is blocked.
116+
117+
> [!TIP]
118+
> Wildcard behavior depends on how your proxy matches domains. Many enterprise proxies
119+
> treat an allowlist entry as a suffix match that covers subdomains at any depth. If yours
120+
> does, the simplest option is to allowlist the suffixes `hf.co` and `huggingface.co`
121+
> these cover every current and future storage and CDN endpoint.
122+
>
123+
> If your proxy only supports single-label wildcards (where `*.hf.co` matches
124+
> `cdn-lfs.hf.co` but not the deeper `us.aws.cdn.hf.co` or `cas-bridge.xethub.hf.co`),
125+
> allowlist the explicit hostnames from the table above. Note that `*.xethub.hf.co` does
126+
> not cover the EU hosts under `xethub-eu.hf.co`, and `*.cdn.hf.co` does not cover the
127+
> two-label `us.aws.cdn.hf.co` / `us.gcp.cdn.hf.co`.
128+
129+
> [!WARNING]
130+
> These hostnames may change as our storage and CDN infrastructure evolves. Where your
131+
> security policy allows it, allowlist the `hf.co` and `huggingface.co` suffixes (all
132+
> subdomains) so your rules don't break when a specific endpoint changes.

0 commit comments

Comments
 (0)