Skip to content

no_proxy variable requires full domain names when multiple are specified #11449

@mdegel

Description

@mdegel

Problem

We have a company network that mirrors the rust registry internally (on artifactory). Also a company proxy is in place for connections outside of the company network. Thus this proxy is configured in all the common places.

The cargo mirror is available on artifactory.company.net
The proxy is defined via common variables, e.g. https_proxy.

We noticed that the no_proxy is only respected in certain situations:

# Specifying a single generic  exclude on the domain works
export no_proxy=".company.net"

# Specifying multiple generic domain excludes do not work
export no_proxy=".company.net,.company.com"

# When specifying multiple generic domain excludes and a full domain name exclude for the server in question also works
export no_proxy=".company.net,.company.com,artifactory.company.net" 

In case of the non-working option we're stuck with errors like this:

$ cargo build
    Updating `artifactory` index
warning: spurious network error (2 tries remaining): [56] Failure when receiving data from the peer (Received HTTP code 502 from proxy after CONNECT)
warning: spurious network error (1 tries remaining): [56] Failure when receiving data from the peer (Received HTTP code 502 from proxy after CONNECT)
error: failed to get `axum` as a dependency of package `foo v0.1.0 (/home/mdegel/git/rust-cargo)`

Caused by:
  failed to query replaced source registry `crates-io`

Caused by:
  download of config.json failed

Caused by:
  failed to download from `https://artifactory.company.net/artifactory/api/cargo/crates.io-cargo-remote/index/config.json`

Caused by:
  [56] Failure when receiving data from the peer (Received HTTP code 502 from proxy after CONNECT)

With specifying the domain name completely artifactory.company.net vs .company.net we have a solution, but it's unclear to us, why this behavior differs from other tools.

Steps

No response

Possible Solution(s)

No response

Notes

Also we're using the nightly toolchain with sparse-registry.

Version

cargo 1.67.0-nightly (e027c4b5d 2022-11-25)
release: 1.67.0-nightly
commit-hash: e027c4b5d25af2119b1956fac42863b9b3242744
commit-date: 2022-11-25
host: x86_64-unknown-linux-gnu
libgit2: 1.5.0 (sys:0.15.0 vendored)
libcurl: 7.86.0-DEV (sys:0.4.59+curl-7.86.0 vendored ssl:OpenSSL/1.1.1q)
os: Ubuntu 20.04 (focal) [64-bit]

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-networkingArea: networking issues, curl, etc.C-bugCategory: bugS-blocked-externalStatus: ❌ blocked on something out of the direct control of the Cargo project, e.g., upstream fix

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions