go: proxy.golang.org 403 forbidden

What version of Go are you using (go version)?

go version go1.16.5 linux/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/root/.cache/go-build"
GOENV="/root/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.16.5"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build2005387958=/tmp/go-build -gno-record-gcc-switches"

What did you do?

When running a go build I’m getting a 403 from https://proxy.golang.org/github.com/klauspost/compress/@v/v1.13.5.zip. When I just navigate to this URL I am able to download the zip file. I get a 302 but the zip file downloads, I never get a 403. Under what circumstances would https://proxy.golang.org return a 403?

/go/pkg/mod/github.com/honeycombio/libhoney-go@v1.14.1/transmission/transmission.go:28:2: github.com/klauspost/compress@v1.13.5: 
reading https://proxy.golang.org/github.com/klauspost/compress/@v/v1.13.5.zip: 403 Forbidden

I’m unsure why it isn’t just getting the zstd dependency which exists here, why it’s falling back to the proxy, and then why the proxy is returning a 403.

What did you expect to see?

go: downloading github.com/klauspost/compress v1.10.11

(basically just getting the dependency and not throwing an error)

What did you see instead?

/go/pkg/mod/github.com/honeycombio/libhoney-go@v1.14.1/transmission/transmission.go:28:2: github.com/klauspost/compress@v1.13.5: 
reading https://proxy.golang.org/github.com/klauspost/compress/@v/v1.13.5.zip: 403 Forbidden

Apologies if this is a honeycombio issue or an environment issue, I’ve been trying to understand why I would ever get a 403 from https://proxy.golang.org but haven’t been able to find anything.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 15 (5 by maintainers)

Commits related to this issue

Most upvoted comments

I had this same issue, try this GOPROXY=https://goproxy.cn go get github.com/klauspost/compress

I had the same issue. When I was trying to reach https://proxy.golang.org/github.com/klauspost/compress/@v/v1.15.1.zip in the browser it said something like “this operation is not permitted in your location”. I switched my VPN from Cyprus to Germany, and it solved it for me O.o

I’m having the same problem the result of go mod tidy is:

go: downloading github.com/klauspost/compress v1.13.6
quickstart imports
        go.mongodb.org/mongo-driver/mongo imports
        go.mongodb.org/mongo-driver/x/mongo/driver imports
        github.com/klauspost/compress/zstd: github.com/klauspost/compress@v1.13.6: reading https://proxy.golang.org/github.com/klauspost/compress/@v/v1.13.6.zip: 403 Forbidden

installing it separately produces the same error:

$ go get github.com/klauspost/compress                                                                                              ─╯
go: downloading github.com/klauspost/compress v1.15.1
go: github.com/klauspost/compress@v1.15.1: reading https://proxy.golang.org/github.com/klauspost/compress/@v/v1.15.1.zip: 403 Forbidden

currently using go version 1.18

I did test it locally on my local computer and it works fine

Can you try cURLing from the container shell session? What about an explicit go get github.com/klauspost/compress@v1.13.5?

Assuming the latter reproducibly fails, I think it’s worth checking the following:

GODEBUG=http2debug=1 go get -x -v github.com/klauspost/compress@v1.13.5 2> debug.txt

The resulting debug.txt will be quite large, but toward the top you should see a “:path” header with a Expires=... value. Can you grab that timestamp and run it through date -d "@$TIMESTAMP"? (my theory is that somehow you’re getting an expired redirect).

Thanks!