Skip to content

Suggest supporting {app_name}_INSTALLER_GITHUB_API_BASE_URL to avoid incorrect domain inference #279

@sunfkny

Description

@sunfkny

I'm using astral-sh/uv and a proxy to access GitHub and set the following environment variable:

$env:UV_INSTALLER_GITHUB_BASE_URL="https://gh-proxy.com/github.com"

When I run:

uv self update -vvv

It fails with a DNS error:

DEBUG uv 0.8.3 (7e78f54e7 2025-07-24)
info: Checking for updates...
TRACE checkout waiting for idle connection: ("https", api.gh-proxy.com)
DEBUG starting new connection: <https://api.gh-proxy.com/>
TRACE Http::connect; scheme=Some("https"), host=Some("api.gh-proxy.com"), port=None
TRACE checkout dropped for ("https", api.gh-proxy.com)
TRACE checkout waiting for idle connection: ("https", api.gh-proxy.com)
DEBUG starting new connection: <https://api.gh-proxy.com/>
TRACE Http::connect; scheme=Some("https"), host=Some("api.gh-proxy.com"), port=None
TRACE checkout dropped for ("https", api.gh-proxy.com)
error: error sending request for url (<https://api.gh-proxy.com/repos/astral-sh/uv/releases>)
  Caused by: client error (Connect)
  Caused by: dns error
  Caused by: 不知道这样的主机。 (os error 11001)

This happens because UV_INSTALLER_GITHUB_BASE_URL is used to construct an API URL by prepending api. to the domain part, resulting in https://api.gh-proxy.com

Ok(format!("{}://api.{}{}", parsed.scheme(), domain, port))

This is incorrect for reverse proxy setups like https://gh-proxy.com/api.github.com.

Suggested Fix

Support an additional environment variable: {app_name}_INSTALLER_GITHUB_API_BASE_URL

If this is set, it should be used as-is as the base URL for GitHub API requests, without any transformation.

This gives users full control and avoids incorrect assumptions based on domain heuristics.

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