charles之localhost、127.0.0.1抓不到包的问题

官网解决方案

Some systems are hard coded to not use proxies for localhost traffic, so when you connect to http://localhost/ it doesn't show up in Charles.

The workaround is to connect to localhost.charlesproxy.com/ instead. This points to the IP address 127.0.0.1, so it should work identically to localhost, but with the advantage that it will go through Charles. This will work whether or not Charles is running or you're using Charles. If you use a different port, such as 8080, just add that as you usually would, e.g. localhost.charlesproxy.com:8080.

You can also put anything in front of that domain, e.g. myapp.localhost.charlesproxy.com, which will also always resolve to 127.0.0.1.

Alternatively you can try adding a '.' after localhost, or replace localhost with the name of your machine, or use your local link IP address (eg. 192.168.1.2).

If Charles is running and you're using Charles as your proxy, you can also use local.charles as an alternative for localhost. Note that this only works when you're using Charles as your proxy, so the above approaches are preferred, unless you specifically want requests to fail if not using Charles

大概意思就是有些系统(本人系统是macOS mojave 10.14.4)抓不到本地服务包 巴拉巴拉一堆

解决方案就是配置 在host文件中添加一行

127.0.0.1 localhost.charlesproxy.com

终于又可以愉快的玩耍了

转载于:https://juejin.im/post/5cb0637cf265da036023a13c

你可能感兴趣的:(charles之localhost、127.0.0.1抓不到包的问题)