http-relay listens on local HTTP and relays requests in this format:
http://localhost:{port}/https://example.com/path?...
It forwards the request to the target absolute URL in the path and returns the upstream response as-is (status code, headers, body).
go install github.com/onewesong/http-relay/cmd/http-relay@latest- Start service (default
127.0.0.1:8080):
http-relay- Send a request:
curl -i "http://127.0.0.1:8080/https://example.com"Check version:
http-relay versionHOST: listen host (default:127.0.0.1)PORT: listen port (default:8080)
Example:
HOST=0.0.0.0 PORT=9000 http-relayEnable request/response dump:
http-relay -wMask auth-related headers in request dump:
http-relay -w -mask-authMasked request headers:
Authorization, Proxy-Authorization, Cookie, X-Api-Key, X-Auth-Token.
Use WIRE_SCOPE (effective only when -w is enabled):
req: dump request onlyresp: dump response onlyreq,resp: dump both (default)
Examples:
WIRE_SCOPE=req http-relay -w
WIRE_SCOPE=resp http-relay -w
WIRE_SCOPE=req,resp http-relay -wSupported proxy env vars:
ALL_PROXY(highest priority)HTTP_PROXY/HTTPS_PROXYNO_PROXY(bypass proxy when matched)
Examples:
HTTPS_PROXY=http://127.0.0.1:7890 http-relay
ALL_PROXY=socks5://127.0.0.1:1080 http-relay
HTTPS_PROXY=http://127.0.0.1:7890 NO_PROXY=example.com http-relayOnly supports /{absolute-url}, for example:
http://127.0.0.1:8080/https://example.comhttp://127.0.0.1:8080/http://httpbin.org/post
Target URL must include http:// or https://.
400: missing or invalid target URL502: upstream connection failure or timeout500: internal server error