Skip to content

Precompiled download drops credentials in HTTP(S)_PROXY and fails with 407 #99

Open

Description

@fastjames

ElixirMake.Downloader.Httpc reads the proxy from HTTPS_PROXY/HTTP_PROXY but keeps only the host and port. When the proxy URL carries credentials (http://user:password@host:port), they're dropped, so a proxy that requires authentication rejects the CONNECT:

Error happened while installing lazy_html from precompiled binary: "couldn't fetch NIF from https://github.com/dashbitco/lazy_html/releases/download/v0.1.13/lazy_html-nif-2.16-aarch64-apple-darwin-0.1.13.tar.gz: {:error, {:could_not_establish_ssl_tunnel, {~c\"HTTP/1.1\", 407, ~c\"Proxy Authentication Required\"}}}".

It then falls back to building from source, which needs a C toolchain and more network access.

To reproduce: with an empty elixir_make cache, set HTTPS_PROXY=http://user:password@host:port for a proxy that requires authentication, then compile a dependency that uses precompiled artefacts. A proxy that only logs requests shows that the CONNECT is the same with and without credentials in the URL, and has no Proxy-Authorization header.

Passing the URL's userinfo to httpc as proxy_auth, as Mix.Utils.proxy_config/1 does, fixes it. With that change the same download succeeds through the same proxy and matches the package's checksum. Hex works through the same proxy.

Also, the Using HTTPS_PROXY: … message prints the proxy URL with the password in it.

Until it's fixed, the workaround is to put the tarball in the cache directory (ELIXIR_MAKE_CACHE_DIR) yourself.

Seen on elixir_make 0.10.1, and main has the same code. Happy to send a PR.

Activity

  1. josevalim commented on Nov 9, 2026

    @josevalim
    Member

    Please do send a pull request. Using a code similar to the one in Mix is a good enough starting point. Then you ca also validate it works accordingly. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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