Go and Hugo Proxy Servers

Donate

Become a backer or sponsor to support our work.

Sponsors

Go’s official module proxy server is blocked by GFW, so it can’t be used properly in China without VPN. However, this can be solved by setting a proxy server, and this article will list some available Go proxy servers. The same applies to the Hugo modules.

Proxy Servers

Proxy ServerURL
GOPROXY.CN (Qiniu Cloud)https://goproxy.cn/
GOPROXY.IOhttps://goproxy.io/
Alibaba Cloud (Aliyun)https://mirrors.aliyun.com/goproxy/
Tencent Cloudhttps://mirrors.tencent.com/go/

Setting Go Proxy Server

1export GOPROXY=https://goproxy.cn/,direct

Or

1go env -w GOPROXY=https://goproxy.cn/,direct

Setting Hugo Modules Proxy Server

Unlike Go, Hugo uses the HUGO_MODULE_PROXY environment variable instead of GOPROXY.

1export HUGO_MODULE_PROXY=https://goproxy.cn/,direct

It can also be set in the configuration.

hugo.yaml

1module:
2  proxy: https://goproxy.cn

hugo.toml

1[module]
2  proxy = 'https://goproxy.cn'

hugo.json

1{
2   "module": {
3      "proxy": "https://goproxy.cn"
4   }
5}

Read more on Module Config.