Skip to main content

Nov 18, 2019 - 1 minute read - Software Testing Evil Tester

How to Proxy on Localhost

TLDR; Use a proxy against localhost by using your machine name or private ip address from ifconfig (or ipconfig).

One issue we might experience when working with locally installed applications or testing apps running from a local docker container is that they run on localhost, and we might want to proxy them.

Generic methods

Instead of http://localhost:80

Use:

  • the machine name e.g. http://machinename:80
  • your private ip address e.g. http://192.168.1.132:80

There are a range of ip addresses that are private and not accessible from the internet

You can find your machine ipaddress by using ifconfig or ipconfig (if you are on Windows)

Using this ip address is the most generic approach for using a proxy on your local machine and should work regardless of which proxy you are using.

When I want to find the ip address on mac I combine the ifconfig with a grep to make viewing the output easier:

ifconfig | grep "inet "

Charles Proxy

https://www.charlesproxy.com/documentation/faqs/localhost-traffic-doesnt-appear-in-charles/

Charles proxy supports the address http://localhost.charlesproxy.com so you could add the port on the end of that and your traffic should appear in Charles.

Fiddler

https://docs.telerik.com/fiddler/Configure-Fiddler/Tasks/MonitorLocalTraffic

Fiddler supports two special case addresses to use instead of localhost

  • http://ipv4.fiddler
  • http://ipv6.fidder

Demo Video

Watch on YouTube

- in Software Testing Evil Tester


You will need a Github account to comment. Or you can contact me with your comment.

I reserve the right to delete spam comments e.g. if your comment adds no value and its purpose is simply to create a backlink to another site offering training, or courses, or etc.