A raw TCP echo server that reflects HTTP requests exactly as received. Built on raw TCP sockets, so headers and body are echoed exactly as received.
docker run -p 8421:8421 aykhans/ech0curl http://localhost:8421/helloRemote-Addr: 172.17.0.1:54321
GET /hello HTTP/1.1
--- Headers ---
Host: localhost:8421
User-Agent: curl/8.5.0
Accept: */*
curl "http://localhost:8421/hello?format=json"{
"method": "GET",
"path": "/hello?format=json",
"proto": "HTTP/1.1",
"remote_addr": "172.17.0.1:54321",
"headers": [
"Host: localhost:8421",
"User-Agent: curl/8.5.0",
"Accept: */*"
],
"query_params": {
"format": [
"json"
]
}
}curl -w "\n%{http_code}" "http://localhost:8421/?status=404"curl -X POST http://localhost:8421/ -d '{"key": "value"}' -H "Content-Type: application/json"Remote-Addr: 172.17.0.1:54321
POST / HTTP/1.1
--- Headers ---
Host: localhost:8421
User-Agent: curl/8.5.0
Accept: */*
Content-Type: application/json
Content-Length: 16
--- Body (16 bytes) ---
{"key": "value"}
| Parameter | Description |
|---|---|
format |
Set to json for JSON output, otherwise plain text |
status |
Set the response status code (any integer) |
| Variable | Default | Description |
|---|---|---|
PORT |
8421 |
Port to listen on |
REMOTE_ADDR_HEADER |
Header to read the client IP from (e.g. X-Forwarded-For, X-Real-IP). When set, the header is removed from the echoed response. |
docker run -p 8421:8421 aykhans/ech0Behind a reverse proxy:
docker run -p 8421:8421 -e REMOTE_ADDR_HEADER=X-Forwarded-For aykhans/ech0Download from releases.
./ech0