Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Can mod_proxy be configured to write all HTTP traffic to a log file, including request and response headers and body?

share|improve this question

migrated from webmasters.stackexchange.com Nov 17 '10 at 18:18

This question came from our site for pro webmasters.

2 Answers 2

I don't believe so, though doing so would be a trivial task for tcpdump.

share|improve this answer

Elaborating on ErikA's answer:

A simple way of doing this is to capture all traffic on port 80 to a file:

tcpdump -w /tmp/packets port 80

And then use "strings" to extract the text content of the packets:

strings /tmp/packets

This will include some garbage but will generally get you what you need. You can also use the "Follow TCP Stream" feature in Wireshark to get a cleaner version of the same thing.

Life is a little more difficult if you're working with SSL traffic. A typical solution would be to use stunnel to intercept the SSL traffic and then proxy it to your web server over the loopback interface; this lets you capture the unencrypted traffic.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.