Skip to content

Proxy Configuration

agent-wechat can route all container traffic through a transparent proxy. This is useful when WeChat needs to connect through a specific network path.

Setting up a proxy

Via the CLI

Terminal window
# HTTP proxy
wx up --proxy user:pass@host:port
# SOCKS5 proxy
wx up --proxy socks5://user:pass@host:port

Via Docker Compose

Set the PROXY environment variable:

environment:
- PROXY=user:pass@host:port

Or pass it on the command line:

Terminal window
PROXY=user:pass@host:port docker compose up -d

How it works

The container uses redsocks + iptables to set up a transparent proxy. All outgoing TCP connections from inside the container are routed through the proxy — this is invisible to WeChat, which thinks it’s connecting directly.

This requires the NET_ADMIN capability in your Docker configuration:

cap_add:
- NET_ADMIN

Proxy formats

FormatExample
HTTP with authuser:pass@proxy.example.com:8080
HTTP without authproxy.example.com:8080
SOCKS5 with authsocks5://user:pass@proxy.example.com:1080
SOCKS5 without authsocks5://proxy.example.com:1080

Changing the proxy

To change the proxy, stop and restart the container with the new value:

Terminal window
wx down
wx up --proxy new-proxy:port

Or update the PROXY environment variable and recreate:

Terminal window
docker compose down
PROXY=new-proxy:port docker compose up -d