2

I'm running Node.js. But for some reason, requests are not being caught by the server. (https://stackoverflow.com/questions/9247482/node-js-server-not-receiving-ajax-requests)

Is there any way to check if there's an HTTP request coming in? Ideally, I want to run something that will "listen" for HTTP request, and then prints them as they come in, along with the URl of that http request (if possible)

2 Answers 2

5

The standard tool would just be to install and run tcpdump.

A capture filter like this. tcpdump -qn -s 0 -A port 80 would capture and print the every packet destined for port 80 on that system. See the man pages, tcpdump is extremely flexible.

3

I like Zoredache's answer of tcpdump as it is really a standard tool, you can also try out ngrep.

First you install it with:

apt-get install ngrep 

Then you can use it to filter network streams looking for certain keywords like GET.

ngrep -W byline 'GET' 'port 80' 
  • -W byline is here to make it look prettier
  • GET is the keyword we are looking for
  • port 80 can be replaced with bpf expression (e.g. ones used with tcpdump)

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.