IPhone – proxy traffic / domains through the phone by tethering to carrier data

dnsiphonePROXYtethering

Would it be possible for me to proxy example.com to http://google.com/example.com/, through my jailbroken iPhone? I would tether my connection to my laptop, so to my laptop it connects to Google's IP address, but my phone then rewrites it to the actual destination.

On my computer (connected to my iPhone's connection), I type http://google.com/yahoo.com/

My iPhone connects to yahoo.com, gets the contents, and sends it back to my computer.

To my computer, it appears I've being connecting to google.com, but I'm actually connected to yahoo.

One way I think it might work is to run a web server with mod_rewrite on my iPhone and a simple php include script, but I'll have to be able to make my web server respond to google.com. Another tack might be to run a custom DNS service on the iPhone. Has anyone taken what seems plausible in theory and accomplished it in practice?

Best Answer

Why not just edit the hosts file on the laptop? Unless you don't own the laptop...

Another option here is to have your iPhone connect via a proxy. Here's an example of how to do it with Fiddler.

In that case any dns lookups your iPhone does will use the hosts file of the machine Fiddler is running on.