Simple HTTP server for logging requests only

user4230508 picture user4230508 · May 16, 2017 · Viewed 16.4k times · Source

I need to run a simple HTTP server that will only log incoming requests and nothing.

It should log whole requests' content. Like headers, cookies, body....

I need just simple solution that I can run in a few minutes and will work.

Implementation language is not important.

Something like Charles but HTTP server instead of proxy

Answer

rich picture rich · Aug 9, 2017

For some super simple alternatives, there's netcat:

$ nc -l -p 8080

And python's inbuilt:

$ python -m SimpleHTTPServer 8080

(In recent versions of python, 3?) this is now:

$ python -m http.server 8080

Netcat won't serve responses so you may not get too far, SimpleHTTPServer won't show POST requests (at least). But occasionally I find both useful.