A simple method we often use when developing changes to web applications for which we don't have control over the DNS is to let the testers add a line in the Windows hosts-file that points to the public IP address of the test environment (for one, McAfee uses this method for their staging environment).

I was wondering whether a similar method is possible on the Android and IPhone, i.e. to add a host lookup entry for a hostname. This would make testing certain webapps quite a bit easier for us.


Yes you can do it by adding entries to the /etc/hosts file in the same manner as you do in windows.

This can be done on a jail-broken iPhone relatively easily (either via SSH or a terminal app on the phone) and similarly from rooted Android. As far as I;m aware it can't be changed from Application code.

Another option you might want to look into is running a Custom DNS server on your internal network but that might be more work than your after.

| improve this answer | |
  • Thanks for answering. I assume that a rooted Android is not something the average user will have knowledge or access to? Would an app be able to take control over this, so that a potential tester would only need to install the app? – Abel Nov 8 '12 at 13:31
  • @Abel: You might want to have a look at this: Guide to editing /etc/hosts – ale Nov 10 '12 at 19:39

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