The Computer Oracle

How can I run ALL HTTP requests through Charles Web Debugging Proxy - including command line ones?

--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Thinking It Over

--

Chapters
00:00 How Can I Run All Http Requests Through Charles Web Debugging Proxy - Including Command Line Ones?
01:18 Answer 1 Score 21
01:58 Answer 2 Score 12
02:42 Answer 3 Score 9
03:03 Accepted Answer Score 4
03:46 Thank you

--

Full question
https://superuser.com/questions/398977/h...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#mac #networking #proxy #http #debug

#avk47



ANSWER 1

Score 21


wget behind proxy (you may have to create the rc file) source

`$ vim ~/.wgetrc`

Add the following line:

http_proxy=http://127.0.0.1:8888

curl behind proxy source

$ vim ~/.curlrc

Add the following line:

proxy = 127.0.0.1:8888

elinks behind proxy source

Find your elinks.conf file with:

sudo find / -name elinks.conf

Add the following line:

protocol.http.proxy.host "127.0.0.1:8888"

Not sure about BlueCrab




ANSWER 2

Score 12


The reason why you don't just get proxying of all HTTP requests is because at the operating system level, there is no such thing as a "HTTP request"; there are only TCP connections. Contacting a HTTP proxy means changing the HTTP request slightly as well as contacting the proxy server instead of the host named in the URL, so it has to be done in the code that implements sending HTTP requests.

curl and wget have their own HTTP code, which uses their own config files — they haven't been programmed to look for proxy settings where Mac OS X keeps them, nor are they using the HTTP libraries provided with Mac OS X that use those proxy settings.




ANSWER 3

Score 9


If you dont want to touch your configuration files, using curl you can do :

curl http://example.com --proxy 127.0.0.1:8888




ACCEPTED ANSWER

Score 4


VPN would create a new network device, you can see it in ifconfig command, and then route all system network to that device, you could see the route use route command.

But HTTP Proxy (in this case, the Charles) is different, it just open a port, to use it, you must specify your application setting to use that port for HTTP stuffs. and as Kevin Reid's answer, curl, wget etc don't read OS X's system wide settings.


If your proxy is SOCKS (Charles supports both HTTP and SOCKS), you could use ProxyChains or tsocks for application doesn't support proxy setting.

e.g.:

$ proxychains git clone https://github.com/rofl0r/proxychains-ng