Proxying sumdb behind a proxy or upstream
Describe the solution you'd like
Now SumDBs will proxy sumdb direct to the accually sumdb server insteads of behine the value of GlobalEndpoint
SumDBs = ["https://sum.golang.org"] => the sumdb id is sum.golang.org
SumDBs = ["https://goproxy.cn/sumdb/sum.golang.org"] => the sumdb id is goproxy.cn
Describe alternatives you've considered
What 's the best way to describe?
- if the
SumDBmatchhttps://(?<proxyHost>.*)/sumdb/(?<sumdb id>.*), use idsumdb id - all sumdb will try if upstream server support, then proxy to
upstream/sumdb/id
@wayjam if Athens is proxying to a sum DB, would you want it to cache results locally?
@arschles I think just a reverse proxy or a middleware with cache are both fine. And if athens can provide two options ideally.
@wayjam I see. That sounds like it could work! We would never have to expire the cache either, which makes this a lot easier.
Would you like to prototype this? No pressure at all if you don't. Just let me know
@arschles Does it mean the Athens could not utilize GOSUMDB in the ATHENS_GO_BINARY_ENV_VARS?
https://sum.golang.org is not accessible in China apparently.
Just ran the server with the config.dev.toml and the envs below:
"ATHENS_LOG_LEVEL":"trace",
"ATHENS_DOWNLOAD_MODE":"async_redirect",
"ATHENS_DOWNLOAD_URL":"https://goproxy.cn",
"ATHENS_SUM_DBS":"https://sum.golang.org",
"ATHENS_GO_BINARY_ENV_VARS":"GOPROXY=https://goproxy.cn,direct; GOSUMDB=sum.golang.google.cn",
Got the error messages on the client side when I ran go get golang.org/x/tools/[email protected] :
go get: golang.org/x/tools/[email protected]: verifying module: golang.org/x/tools/[email protected]: initializing sumdb.Client: checking tree#5772989: reading http://127.0.0.1:3000/sumdb/sum.golang.org/tile/8/2/000.p/88: 502 Bad Gateway