9

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?

2
  • 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. Commented Sep 19, 2011 at 16:19
  • Awesome. I guess mine decided to use port 8888 instead. If you post your comment as the answer I will accept it. Thanks. Commented Sep 19, 2011 at 17:46

2 Answers 2

20

I had some success using port 8888: curl http://www.google.com --proxy 127.0.0.1:8888

Sign up to request clarification or add additional context in comments.

1 Comment

that the only solution worked for me i have proxy server on same network curl only accepted 127.0.0.1:PORT .
3

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.