Search code examples
http-redirectweb-traffic

Redirect all web traffic from specified program to localhost?


I'm trying to debug program that uses many ports (other than 80, 443) for retrieving data, and i want to create "redirector" that redirect all connections from (for example: example.com) to localhost.

Is that possible without directly hacking program? How to do that?


Solution

  • If the program is running on your local machine, you could modify /etc/hosts and add the following line:

    example.com 127.0.0.1

    This will route all connections from your machine to example.com to localhost (127.0.0.1).