How can I capture traffic to localhost using Wireshark?
The short answer is, on Windows you can't. The Wireshark Wiki describes a couple of workarounds, such as installing a virtual network card using the Microsoft Loopback Adapter, however the results are less than optimal. Their suggestion of setting up a new route will give you all of your data twice, and could put unnecessary load on your network if left enabled, but you should get the data.
If you capture on the local loopback interface (called lo0
on my machine), that will show you the traffic between localhost and itself. The loopback is where localhost traffic goes when it doesn't have to go through the NIC interface.