athens icon indicating copy to clipboard operation
athens copied to clipboard

Proxying sumdb behind a proxy or upstream

Open wayjam opened this issue 6 years ago • 4 comments

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?

  1. if the SumDB match https://(?<proxyHost>.*)/sumdb/(?<sumdb id>.*), use id sumdb id
  2. all sumdb will try if upstream server support, then proxy to upstream/sumdb/id

wayjam avatar Nov 21 '19 11:11 wayjam

@wayjam if Athens is proxying to a sum DB, would you want it to cache results locally?

arschles avatar Dec 03 '19 02:12 arschles

@arschles I think just a reverse proxy or a middleware with cache are both fine. And if athens can provide two options ideally.

wayjam avatar Dec 03 '19 07:12 wayjam

@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 avatar Dec 04 '19 02:12 arschles

@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

will-beta avatar Jun 28 '21 03:06 will-beta