A simple golang HTTP/S server that echoes back request attributes to the client in JSON formats.
By default the certificate CN is the hostname of the machine where the program is running.
docker run -p 80:8888 -p 443:8443 --rm -t mo3m3n/http-echo
> http-echo --help
Usage of ./http-echo:
-http int
http port value (default 8888)
-https int
https port value (default 8443)
/
: sends back the full request/hostname
: sends back the hostname where http-echo is running
curl -b "test=bar" -k https://localhost:8443/path\?a\=foo1\&b\=foo2
{
"http": {
"cookies": [
"test=bar"
],
"headers": {
"Accept": "*/*",
"Cookie": "test=bar",
"User-Agent": "curl/7.70.0"
},
"host": "localhost:8443",
"method": "GET",
"path": "/path",
"protocol": "HTTP/2.0",
"query": "a=foo1\u0026b=foo2",
"raw": "GET /path?a=foo1\u0026b=foo2 HTTP/1.1\r\nHost: localhost:8443\r\nUser-Agent: curl/7.70.0\r\nAccept: */*\r\nCookie: test=bar\r\n\r\n"
},
"os": {
"hostname": "traktour"
},
"tcp": {
"ip": "[::1]",
"port": "53364"
},
"tls": {
"cipher": "TLS_AES_128_GCM_SHA256",
"sni": "localhost"
}
}