Recently I came across a question I didn’t know the answer to. The question was: “How to check which HTTP headers are received by my application?”. After some research I found the answer and, in this post, I will show you how to find the HTTP headers received by your web server or application.
Check if the Web Server is running
You can find this information by running a tcpdump command with some arguments.
In my lab, I am running an apache web server on an Ubuntu Linux host.
To confirm this, you can run a ss or netstat command.
sudo ss -tlpn | grep 80
Another command that you can use is the systemctl status.
systemctl status apache2
Send the client request with custom headers
In order to check if the headers are received by the Linux host, first you need to send them. I am using the curl command for this purpose, but if you do not want to use the CLI and prefer to use the UI, you can use an application like Postman, for example.
Inspect the traffic on the Web server with tcpdump
sudo tcpdump -i enp0s8 -A 'tcp port 80 and (((ip[2:2] - ((ip&0xf)<<2)) - ((tcp&0xf0)>>2)) != 0)'
I hope you find this post helpful.
What method do you use to get the same result? Please share your thoughts in the comments.