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.app
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.less
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.dom
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).ide
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 Charlesthis
大概意思就是有些系統(本人系統是macOS mojave 10.14.4)抓不到本地服務包 巴拉巴拉一堆code
解決方案就是配置 在host文件中添加一行ci
127.0.0.1 localhost.charlesproxy.comget
終於又能夠愉快的玩耍了requests