Proxy Curl Through Charles Proxy
I’m working on a project at the moment with an API, so I usually talk to it with curl. I also love Charles Proxy, a very handy tool that I use to inspect, repeat and edit requests. Today I used them together!
Curl via Charles
There might be a better way to do this as it does seem rather hacky, but here’s my approach:
- Make your web request to
http://localhost:8888
with whatever path/query string/verb/post data/whatever that you would normally include - Add a
Host:
header
Were you expecting more to it? Sorry :)
So to make a curl request to http://api.joind.in/v2.1/events via Charles, I do this:
curl -H "Host: api.joind.in" http://localhost:8888/v2.1/events
You’ll see in the overview that Charles then sends the request over to the expected URL. Useful? Hacky? Comments box is below ….
Is there an opensource you know that has similar functionality with charles proxy?
You can check OWASP ZAP https://www.owasp.org/index.php/OWASP_Zed_Attack_Proxy_Project
Nice! Using the replace tool you can also proxy localhost requests to an https remote endpoint.