1

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.

closed as off-topic by pnuts, user135384, jonsca Nov 12 '17 at 22:47

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "It is a question about creating/developing a web application." – pnuts, Community, jonsca
If this question can be reworded to fit the rules in the help center, please edit the question.

2

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.

  • 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.