Small Zig HTTPS forward proxy for Bun fetch() running in Docker.
- Supports HTTPS targets via HTTP
CONNECT - Requires
Proxy-Authorization: Basic ... - Exposes a plain HTTP proxy endpoint such as
http://user:password@127.0.0.1:8080 - Intentionally does not support plain HTTP target URLs in v1
docker build -t zig-http-proxy .docker run --rm \
-p 8080:8080 \
-e PROXY_USERNAME=user \
-e PROXY_PASSWORD=password \
zig-http-proxyOptional environment variables:
PROXY_BIND_HOSTdefault0.0.0.0PROXY_PORTdefault8080PROXY_CONNECT_TIMEOUT_MSdefault10000PROXY_IO_BUFFER_SIZEdefault16384PROXY_MAX_HEADER_BYTESdefault32768
const res = await fetch("https://foobar.com", {
proxy: "http://user:password@127.0.0.1:8080",
});
console.log(res.status);Successful HTTPS request through the proxy:
curl -x http://user:password@127.0.0.1:8080 https://example.com -IExpected authentication failure:
curl -x http://127.0.0.1:8080 https://example.com -IExpected unsupported plain HTTP target:
curl -x http://user:password@127.0.0.1:8080 http://example.com -I