How can I redirect HTTP requests made from an iPad?
Since on an iPad we cannot edit the hosts file (without jailbreaking), how can we arbitrarily redirect web traffic to another url?
This would be important for something such as developing a website that uses a Virtual Host configuration where you want to redirect to a development machine.
(This is related to this question: Can I edit an iPad's host file?)
Solution 1:
The way to get around this limitation of the iPad is to use a HTTP proxy server, such as Squid running on another machine where you can edit the hosts file.
On the iPad Under Settings -> Network -> Wi-Fi -> (Your network) There is a HTTP Proxy setting which can be set to manual. Enter you proxy information here.
Once this is set up you would be able to manipulate the iPad as if you were changing the hosts file.
Solution 2:
I found you just have to modify the Wifi settings in your iPad to use the IP address of your development machine as an HTTP proxy (as explained in the aforementioned article):
That way, it's enough to be able to access your web application on your iPad by entering the url of the virtual host (e.g. local.mywebapp.com
). It's easy and quick, but unlike Will Koehler's solution, you will however not be able to access Internet from the iPad. But most of the time it's not really a problem, since you just want to test your own application.