Skip to content

Cargo does not respect no_proxy environment variable #6114

@lily-mara

Description

@lily-mara

Another issue in the long tradition of HTTP proxies! The fun just never stops. Because cargo does not support private registries, internal packages are stored in our self-hosted internal git host. Since we do use public cargo packages, we still need access to gitlab, which requires a forward proxy. Unfortunately, downloading dependencies from our internal git host requires that there be no forward proxy on the request. This requires the no_proxy environment variable. This way, external requests can be proxied and internal requests can be sent directly. Cargo does not seem to respect this variable and as a result, our internal dependencies can not be installed. This is a big blow to using rust at my company. The no private registry thing was a tough sell, but if this doesn't work I just don't know if it's feasible.

What did I do:

export http_proxy=http://proxy.corp.com
export HTTP_PROXY="${http_proxy}"
export HTTPS_PROXY="${http_proxy}"
export https_proxy="${http_proxy}"
export no_proxy=git.corp.com

cargo build

What happened:

    Updating git repository `https://git.corp.com/tools/logging-helper`
warning: spurious network error (2 tries remaining): failed to receive HTTP 200 response: got 404; class=Net (12)
warning: spurious network error (1 tries remaining): failed to receive HTTP 200 response: got 404; class=Net (12)
error: failed to load source for a dependency on `logging-helper`

Caused by:
  Unable to update https://git.corp.com/tools/logging-helper#b0cb6965

Caused by:
  failed to clone into: /Users/me/.cargo/git/db/logging-helper-68c9501fefa8f883

Caused by:
  failed to receive HTTP 200 response: got 404; class=Net (12)

If I unset all of the proxy variables, then I can download the internal dependencies, but none of the external dependencies.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions