Xcode Charles (HTTP Proxy) doesn't capture localhost traffic Xcode Charles (HTTP Proxy) doesn't capture localhost traffic xcode xcode

Xcode Charles (HTTP Proxy) doesn't capture localhost traffic


Use localhost.charlesproxy.com instead of localhost. That's setup on the charlesproxy.com DNS to point to 127.0.0.1, and always will. And because it's not literally localhost it should bypass the OS's hardwired logic for localhost.

It is also possible to use local.charles, but only if Charles is actually running and you're using it as your proxy. So I prefer the localhost.charlesproxy.com solution.

I'll update that FAQ too.


I found an acceptable work-around. It involves editing your hosts file to create an alias for localhost. Each developer will have to do this on his/her dev machine, but it should be smooth sailing after that.

Run echo '127.0.0.1 local.website.com' >> "/etc/hosts" and then change your host config code to something like this:

#if DEBUG    var API_HOST = "http://local.website.com"#else    var API_HOST = "https://website.com"#endif


I am using my hostname instead of localhost. To get your hostname simply type hostname in the terminal and then change the URL to "http://your-host-name"