Skip to content

x/pkgsite/cmd/pkgsite: local pkgsite with -proxy doesn't use netrc auth to private GOPROXY #60299

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
dnwe opened this issue May 19, 2023 · 2 comments
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. pkgsite

Comments

@dnwe
Copy link

dnwe commented May 19, 2023

What did you do?

Attempted to use a .netrc file to provide credentials to pkgsite for use when fetching via a private GOPROXY.

The regular go mod commands are able to do this, so with a properly configured .netrc file the following succeeds:

GOPROXY="https://goproxy.company.com" go mod download -x github.heygears.company.com/org/repo@latest

But attempting to view the documentation of github.heygears.company.com/org/repo via pkgsite:

GOPROXY="https://goproxy.company.com" pkgsite -proxy

Fails with 401 authentication errors as the internal/proxy/client.go code doesn't attempt to insert authentication headers, unlike cmd/go which does

What did you expect to see?

pkgsite should be able to use authentication against a private GOPROXY

What did you see instead?

pkgsite does not pass authentication headers to the http requests it makes to a private GOPROXY

@dnwe dnwe added the pkgsite label May 19, 2023
@gopherbot gopherbot added this to the Unreleased milestone May 19, 2023
@suzmue suzmue modified the milestones: Unreleased, pkgsite/later May 22, 2023
@mxk
Copy link

mxk commented Apr 22, 2024

Did you ever find a solution to this? I finally managed to configure athens proxy to get private repos, but the links rendered by pkgsite frontend aren't pointing at the right files.

@mxk
Copy link

mxk commented May 5, 2024

For anyone else who runs into this issue, I managed to work around it by passing HTTP_PROXY and HTTPS_PROXY to frontend and running a custom proxy server that injects credentials from netrc. Really ugly, but it works without having to modify pkgsite source.

@prattmic prattmic added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Apr 15, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. pkgsite
Projects
None yet
Development

No branches or pull requests

5 participants