Skip to content

Zig package manager ignores HTTP_PROXY, fails to download dependencies through Squid #1429

@Mossaka

Description

@Mossaka

Problem

The Zig build system's package manager does not respect the standard HTTP_PROXY / HTTPS_PROXY environment variables. When running inside the AWF firewall container, Zig's dependency downloads fail because they attempt direct connections instead of routing through the Squid proxy.

Details

Zig uses its own HTTP client implementation for package fetching (in build.zig.zon files), which bypasses the system proxy settings. This means:

  • zig build fails when it tries to fetch dependencies
  • The iptables NAT rules redirect the traffic to Squid, but Zig's HTTP client doesn't send proper CONNECT requests
  • The connection fails or times out

Possible Workarounds

  1. Transparent proxy mode: Configure Squid for transparent proxying of Zig traffic (may require SSL bump)
  2. Pre-fetch dependencies: Cache Zig packages in the container or use a local mirror
  3. Upstream fix: File an issue with Zig to support HTTP_PROXY environment variables

Impact

Affects Zig projects that use build.zig.zon for dependency management (increasingly common in the Zig ecosystem).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions