Skip to content

Mo3m3n/http-echo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

http-echo

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.

How to use

docker run -p 80:8888 -p 443:8443 --rm -t mo3m3n/http-echo

Params

> http-echo --help
Usage of ./http-echo:                                        
  -http int
    	http port value (default 8888)
  -https int
    	https port value (default 8443)

Endpoints

  • /: sends back the full request
  • /hostname: sends back the hostname where http-echo is running

Output example

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"
  }
}

Credits

mendhak/docker-http-https-echo

About

Echo HTTP/S request properties back to client

Resources

License

Stars

Watchers

Forks

Packages

No packages published