Get HTTP request with nc command
Answer:
nc command is a very useful tool for network diagnosis, e.g. when you want to know the exact requests sent by your HTTP client (e.g. browser) to your web server, you can easy test with nc.
1. In your server, start nc and listen on port 80
# sudo nc -l -p 80
2. In your browser, type the server IP address.
3. In your shell, HTTP requests will be printed.
GET / HTTP/1.1
Host: example.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.3) Gecko/20090712 Firefox/3.5.3
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive