A lightweight HTTP proxy server written in Go, supporting domain-based forwarding rules.
- 🚀 High performance proxy server
- 🔍 Domain pattern matching (exact and wildcard)
- ⚙️ YAML configuration file
- 🔒 HTTPS tunneling support
- 📝 Logging with logrus
Edit config.yaml
to define forwarding rules:
rules:
- domainPattern: "*.cn" # Wildcard match
forwardMethod: "direct" # direct or proxy
- domainPattern: "google.com" # Exact match
forwardMethod: "proxy"
- domainPattern: "*.baidu.com"
forwardMethod: "block" # block site
- Install Go (1.20+)
- Clone this repository
- Build the project:
go build -o proxy
go install github.com/xtccc/http_proxy@latest
Start the proxy server:
./proxy -listen :8080 -proxy 127.0.0.1:8079
Default listen address is :8080
The proxy supports two forwarding methods:
direct
: Connect directly to target serverproxy
: Forward through upstream proxy (default: 127.0.0.1:8079) (http protocol)
Logs are written to http_proxy.log
in the current directory.
rules:
- domainPattern: "*.cn"
forwardMethod: "direct"
- domainPattern: "google.com"
forwardMethod: "proxy"
- domainPattern: "*.bilibili.com"
forwardMethod: "direct"
To enable global direct connection, add the following rule to your config.yaml
:
rules:
- domainPattern: "*"
forwardMethod: "direct"
This configuration will forward all HTTP/HTTPS traffic directly without using the proxy server. Use with caution.
GPLv3