Over 2 years ago I posted a couple of blogs showing how to monitor iPhone HTTP and HTTPS traffic. If you haven’t seen these two blogs, it’s recommended you read them for some initial setup before continuing.
This was demonstrated using a tool called Charles. What I showed was pretty basic, Charles can actually do a lot more than this.
Recently one of our clients wanted a build of one of our apps connected to their debug server so they could test some API changes. Instead of changing url strings in the code, recompiling, provisioning and code signing, you can simply take the existing app and hook it up to Charles in order to reroute all traffic from your production url to your development url.
To do this, first connect your iPhone through Charles (as demonstrated in Part 1).
Now through the Tools menu, select “Map Remote…”
A window will appear, fill in your map from and map to criteria. Any fields you don’t fill in will act as a wildcard, in the example below all HTTP path/GET parameters will be routed from the live server to the dev server.
That’s it. Now whenever a request from the client app tries to access the live server, Charles stops it and instead forwards it to your dev server.
You can also choose “Map Local…” through the Tools menu and map a url to a file on your computer.