Middleware
Job: run a program that sees every message and can change or drop it (tokens, PII, custom routes).
sudo gor --input-raw :80 --middleware "/opt/middleware" --output-http="http://staging.example.com" The process reads messages from STDIN and writes modified requests to STDOUT. Communication is asynchronous: request, origin response, and replayed response can arrive in any order. Keep state keyed by request id.
Origin responses reach middleware only with --input-raw-track-response. Replayed responses require --output-http-track-response.
Protocol
Each line is hex-encoded. Decoded payload is a meta header, newline, then the raw HTTP body. Meta: type (1 request, 2 origin response, 3 replayed response), request id, timestamp, latency on responses.
Emit the request back hex-encoded, keeping the original meta header. Drop a request by writing nothing. If you receive responses, emit them too even if unchanged.
Examples: examples/middleware.
JavaScript middleware
gor --input-file requests.gor --js-middleware ./rewrite.js --output-http="http://staging.example.com" --js-middleware is goja, distinct from --middleware.
Push capture off the web box: distributed.