简体   繁体   中英

How to allow curl via a local proxy?

According the the Charles Proxy configuration page , you can manually set up a proxy if you use your localhost with port 8080.

The syntax is curl --proxy localhost:8080 http://google.com/

However, this is not working for me. Here is my syntax and results - i'm also using the -v option for debugging:

curl -v --proxy localhost:8080 http://google.com/

* About to connect() to proxy localhost port 8080 (#0)
*   Trying 127.0.0.1... Connection refused
*   Trying ::1... Connection refused
*   Trying fe80::1... Connection refused
* couldn't connect to host
* Closing connection #0
curl: (7) couldn't connect to host

I can connect to localhost:8080 in the web browser, and the results are logged in the proxy. However this is not working, the connecting is refused and nothing is logged.

So far I have also tried:

- executing this as root
- using 127.0.0.1 instead of localhost
- using wget instead of curl
- disabling the system firewall

What am I doing wrong? What else can I try?

我使用端口8888取得了一些成功: curl http://www.google.com --proxy 127.0.0.1:8888

Connection refused would suggest that nothing is listening on port 8080. Charles has to be running (and listening on port 8080) for curl to be able to use it as a proxy. That or you've got a firewall actively blocking that port, preventing anything from connecting.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM