Safeguard
Developer Tools•

GOPROXY comma versus pipe: when Go falls back to the next source

In GOPROXY, a comma falls back only after a 404 or 410, while a pipe falls back after any error. Here is how that affects private mirrors and outages.

Safeguard Security Team
3 min read

In the GOPROXY list, a comma tells Go to try the next source only after a 404 Not Found or 410 Gone. A pipe tells it to try the next source after any error, including timeouts. The default is https://proxy.golang.org,direct, so by default a failing public proxy does not trigger a direct fetch.

The default

The Go modules reference gives the default value as:

https://proxy.golang.org,direct

The keyword direct means download from the version control repository where the module is developed. The keyword off means no network access is attempted.

How the separators behave

From the reference: list elements may be separated by commas or pipes, which determine error fallback behavior. When a URL is followed by a comma, the go command falls back to later sources only after a 404 or 410. When a URL is followed by a pipe, it falls back after any error, including non-HTTP errors such as timeouts.

An example of each:

GOPROXY=https://corp.example.com,https://proxy.golang.org
GOPROXY=https://corp.example.com|https://proxy.golang.org

With the comma, a company proxy that is down returns an error and the build stops. With the pipe, the build quietly continues to the public proxy.

Which one to choose

The comma is stricter and often what you want. It means "my internal proxy is the source of truth, and only a clean not found sends you elsewhere." A failure is loud, so you notice an outage and nobody gets a surprise download from somewhere you did not intend.

The pipe favors availability. It suits a mirror that is a convenience, not a control. The cost is that an outage or a misconfiguration changes where code comes from without any message.

NeedSeparator
Internal proxy is a policy controlComma
Internal proxy is only a cachePipe
Never reach the internetSingle entry, or off

Pair it with private module settings

If some modules must never go to a public proxy, mark them private. GOPRIVATE and related variables are covered in what GOPRIVATE, GONOPROXY and GONOSUMDB each do.

Test your setup

Run a build with the network path to your proxy blocked and see what happens. Then block only the public proxy. You want the results to match your intent, and it is easier to learn that on a Tuesday afternoon than during an incident.

Safeguard dependency and SBOM scanning can list the modules a build resolves and flag known vulnerabilities. You can try a free scan at gold.safeguard.sh/scan.

Quick check

What is the default GOPROXY?

https://proxy.golang.org,direct, according to the Go modules reference.

Does a timeout on the first proxy trigger fallback with a comma?

No. Only a 404 or 410 does. Use a pipe if you want fallback after any error.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.