I could not see any requests from my localhost server

1. Problems

  • I'm running a localhost server at port 3000, but I couldn't see any traffics from the Proxyman app
  • I'm developing a local server that makes requests to the Internet, but none of them show on the Proxyman app

2. Why does it happen?

By default, all localhost traffic does not go through HTTP/HTTPS Proxy on macOS, so that we couldn't see any requests or responses on the Proxyman app.
If you're using a 3rd-party Networking library, such as curl, java, axios, ... The traffic might not go through the HTTP Proxy by default. Please check this Doc

3. Solutions

There are two solutions to fix it:
  • Use localhost.proxyman.io instead of localhost
Proxyman uses Cloudflare and set the DNS of localhost.proxyman.io to 127.0.0.1 (localhost). As a result, Proxyman can capture the local traffic as usual ✅
For example:
Old URL
New URL
localhost:3000
localhost.proxyman.io:3000
localhost:8080
localhost.proxyman.io:8080
...
...
  • Or Map localhost to the domain name in /etc/hosts
  1. 1.
    Open etc/hosts file
1
$ sudo vim /etc/hosts
Copied!
2. Add Domain Name with both IPv4 and IPv6 (You can change the proxyman.local with your name)
1
127.0.0.1 proxyman.local
2
::1 proxyman.local
Copied!
3. Save the file with sudo permission
4. Follow this guideline to make sure *.local traffic isn't in the proxy bypass list
5. Access your localhost server by http://proxyman.local:3000 (replace 3000 with your localhost ports)
6. Enjoy debugging!
Make sure you add both IPv4 (127.0.0.1 proxyman.local) and IPv6 (::1 proxyman.local). Otherwise, you might encounter the 5 seconds DNS delay.
Last modified 6mo ago