Skip to the content.

Go modules

Use the proxy as GOPROXY. The examples use the upstream name goproxy; replace it with the name your operator gave the upstream (what you need).

   
Upstream type go
Package source https://proxy.example.com/v1/goproxy
Clients the go command
Tested go 1.24: in CI on every push and in the client lab.

Configure

For a user (written to the go command’s own environment file):

go env -w GOPROXY=https://proxy.example.com/v1/goproxy

In a CI job or a Dockerfile:

export GOPROXY=https://proxy.example.com/v1/goproxy

Leave ,direct off. With GOPROXY=<proxy>,direct the go command fetches a module the proxy answers 404 or 410 for straight from its version-control host — past the cache and every check. (A refusal, 403, is final in both forms.)

Checksum verification stays on, with nothing to configure. The go command verifies every module against the checksum database (sum.golang.org) and by default contacts it directly, which fails where only the proxy is reachable. The proxy serves the database under the same address (/v1/goproxy/sumdb/sum.golang.org/…), the go command finds it there by itself, and every answer is signed by the database and verified with the key built into the go command: no trust is placed in the proxy. GOSUMDB, GONOSUMDB and GOFLAGS=-insecure stay unset.

Authenticate

Only when the proxy has access control switched on. The proxy takes your proxy token as the password of HTTP Basic authentication, with any user name.

In ~/.netrc (mode 600), which the go command reads for the proxy’s host:

machine proxy.example.com
  login pullthrough
  password <token>

When the proxy’s address has a port (https://proxy.example.com:8443), the go command looks the credentials up under the host and the port: the machine line is machine proxy.example.com:8443. An entry without the port is not used for it. (curl-based clients need the opposite; see nix.md.)

or in the GOPROXY URL:

export GOPROXY=https://pullthrough:<token>@proxy.example.com/v1/goproxy

The go command sends credentials over HTTPS only.

Trust a private CA

The go command uses the system trust store; a CA that is not in it is named in the environment:

export SSL_CERT_FILE=/etc/ssl/corp-ca.pem

Check that it works

go mod download rsc.io/quote@v1.5.2

go env GOPROXY shows the effective setting; with -x, go mod download prints every URL it fetches.

Good to know

On the proxy

upstreams:
  goproxy:
    type: go
    url: https://proxy.golang.org

@v/list and @latest are served live; a version’s .info, .mod and .zip are cached immutably. The sumdb upstream setting names the checksum databases the proxy serves (default sum.golang.org; off disables it). Details: backends: go.