|
| 1 | +# GitHub mirror |
| 2 | + |
| 3 | +[中文](zh-CN/mirror.md) | [English](mirror.md) |
| 4 | + |
| 5 | +Unreleased: release 0.6.2 has no mirror setting. |
| 6 | + |
| 7 | +Foojay links the JDKs of most distributions to GitHub Releases, so `vfox install java@21-tem` downloads from `github.com`. If github.com is slow or unreachable where you are, set `VFOX_JAVA_GITHUB_MIRROR` and the plugin sends these downloads through a GitHub mirror. |
| 8 | + |
| 9 | +The value is a URL prefix. The plugin puts it in front of the GitHub URL, and adds a `/` if the value does not end in one. For Temurin 21.0.8 on Linux x64: |
| 10 | + |
| 11 | +| `VFOX_JAVA_GITHUB_MIRROR` | vfox downloads | |
| 12 | +| --- | --- | |
| 13 | +| not set | `https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.8%2B9/OpenJDK21U-jdk_x64_linux_hotspot_21.0.8_9.tar.gz` | |
| 14 | +| `https://gh-proxy.org/` | `https://gh-proxy.org/https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.8%2B9/OpenJDK21U-jdk_x64_linux_hotspot_21.0.8_9.tar.gz` | |
| 15 | + |
| 16 | +[gh-proxy](https://gh-proxy.org/) takes URLs in this form, and so does any service that takes the GitHub URL after its own address. The plugin does not run any of them and cannot vouch for them. The value must start with `http://` or `https://`. vfox takes any other address for a file on disk, so a download from GitHub stops with `VFOX_JAVA_GITHUB_MIRROR must start with http:// or https://` instead. |
| 17 | + |
| 18 | +## Set it |
| 19 | + |
| 20 | +In bash or zsh, for the current shell: |
| 21 | + |
| 22 | +```bash |
| 23 | +export VFOX_JAVA_GITHUB_MIRROR=https://gh-proxy.org/ |
| 24 | +``` |
| 25 | + |
| 26 | +Put the same line in `~/.bashrc` or `~/.zshrc` to keep it. In PowerShell: |
| 27 | + |
| 28 | +```powershell |
| 29 | +$env:VFOX_JAVA_GITHUB_MIRROR = "https://gh-proxy.org/" |
| 30 | +``` |
| 31 | + |
| 32 | +To set it for every terminal opened afterwards: |
| 33 | + |
| 34 | +```powershell |
| 35 | +[Environment]::SetEnvironmentVariable('VFOX_JAVA_GITHUB_MIRROR', 'https://gh-proxy.org/', 'User') |
| 36 | +``` |
| 37 | + |
| 38 | +Then install as usual, `vfox install java@21-tem`. To go back to github.com, unset the variable. |
| 39 | + |
| 40 | +## What goes through the mirror |
| 41 | + |
| 42 | +Only downloads from `https://github.com/`. A JDK on any other host downloads from there as before, and the requests to Foojay do not change. |
| 43 | + |
| 44 | +Where Foojay links each distribution (2026-10-21): |
| 45 | + |
| 46 | +| Short names | Download from | |
| 47 | +| --- | --- | |
| 48 | +| `tem`, `librca`, `sem`, `semcrt`, `sapmchn`, `kona`, `albba`, `mandrel`, `trava`, `adpt`, `adptj9`, `eliya`, `ojdkbld`, `gln`, `grl8`, `grl11`, `grl16`, `grl17`, `grl19` | GitHub | |
| 49 | +| `graalce` | GitHub, except the monthly feature releases that `java@25-graalce` installs, which come from Oracle's GraalVM Download Service. `java@25.4.4.1-graalce` is the same file from GitHub | |
| 50 | +| `nik` | GitHub for the newer releases, BellSoft's server for the older ones | |
| 51 | +| `open` | jdk.java.net, except JDK 8 and most 11.x builds, which come from GitHub | |
| 52 | +| `zulu`, `amzn`, `ms`, `oracle`, `graal`, `jb`, `bsg`, `opnlgc`, `rdht` | the vendor's server or a CDN, not GitHub | |
| 53 | + |
| 54 | +Loongnix (`lnxabi1`, `lnxabi2`) downloads from ftp.loongnix.cn and is not mirrored. |
| 55 | + |
| 56 | +To see where one release downloads from, ask Foojay for its package and read `direct_download_uri`. It is mirrored if it starts with `https://github.com/`. [foojay.md](foojay.md) has the queries for other platforms. |
| 57 | + |
| 58 | +```bash |
| 59 | +curl -s 'https://api.foojay.io/disco/v3.0/packages/jdks?distribution=temurin&version=21.0.8&architecture=amd64&operating_system=linux&lib_c_type=glibc&archive_type=tar.gz&directly_downloadable=true' \ |
| 60 | + | jq -r '.result[0].links.pkg_info_uri' | xargs curl -s | jq -r '.result[0].direct_download_uri' |
| 61 | +``` |
| 62 | + |
| 63 | +``` |
| 64 | +https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.8%2B9/OpenJDK21U-jdk_x64_linux_hotspot_21.0.8_9.tar.gz |
| 65 | +``` |
| 66 | + |
| 67 | +## Notes |
| 68 | + |
| 69 | +- The plugin gives vfox no checksum, so vfox does not verify the download (`WARNING: Checksum is not provided, skip verify...`, see [foojay.md](foojay.md#what-the-plugin-asks)). Through a mirror, the archive is whatever the mirror serves. Use one you trust. |
| 70 | +- The variable only changes where `vfox install` downloads a JDK from. `vfox add java` does not use it. For a proxy that covers all of vfox, see [Network](troubleshooting.md#network). |
0 commit comments