HTTP Proxy is a lightweight HTTP reverse proxy written in Go. It listens on a given address and port, and forwards all HTTP requests to a specified target server. It's ideal for simple debugging, local forwarding, and lightweight HTTP routing tasks.
go install github.com/sebps/http-proxy- Forwards all incoming HTTP requests to a target host and port
- Logs request method, path, and body
- Optional automatic CORS headers via
--withCors - Clean CLI with
--help,--targetHost,--targetPort,--targetProtocol,--sourceAddr, and--sourcePort - Simple and minimal β no external dependencies beyond Go stdlib
http-proxy [options]| Flag | Description | Default |
|---|---|---|
--targetHost |
Target host to forward requests to (required) | |
--targetPort |
Target port to forward requests to | 80 or 443 based on protocol |
--targetProtocol |
Protocol to use to reach the target (http or https) |
http |
--sourceAddr |
Source address to bind the proxy server | localhost |
--sourcePort |
Source port to listen on | 80 |
--withCors |
Enable automatic CORS headers | false |
-h, --help |
Show help message and exit |
Start a proxy that listens on port 8888 and forwards to https://example.com with CORS support:
./http-proxy --targetHost example.com --targetProtocol https --sourcePort 8888 --withCorsBind to all interfaces instead of just localhost:
./http-proxy --targetHost example.com --targetPort 443 --targetProtocol https --sourceAddr 0.0.0.0π HTTP Proxy starting on http://localhost:8888
π Forwarding all requests to https://example.com:443
π₯ GET request on path: /api
π Body: {"query": "hello"}