I'd like to be a man-in-the-middle between my iPhone and the internet for debugging purposes. In particular, I'd like to convince my iPhone that a particular host on the internet is my local development machine, and that it should not actually connect out to the net (so the app believes it's contacting a production server when in fact it's hitting a local box).

I can disable 3G and use my Mac's ad-hoc WiFi, but adding /etc/hosts entries of course won't route requests to the local machine, since it's just doing NAT, not handling DNS or other protocols on behalf of the phone.

The only thing I can think of is to jailbreak it and mess with the hosts file on the device, but I'd rather not do that if I can avoid it. Can anyone think of another way of going about this?

link|improve this question

feedback

1 Answer

up vote 6 down vote accepted

Setup a DNS server on your mac, configure your router to use your mac as it's DNS server and create DNS entries that point to where you want them.

link|improve this answer
Oh, I can't believe it didn't think of that :). I might go a little bit simpler and just configure the device directly to use a DNS server on my Mac instead if getting the router involved, but the idea will work nonetheless. Thanks! – Collin Allen Dec 4 '10 at 4:36
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.