Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have an iPad that needs to be able to connect to a server via its short hostname, e.g. http://app instead of The network it connects to assigns it a domain name other than so it doesn't work automatically.

Is there a way to add a hosts entry (/etc/hosts) for that server in iOS, or add the appropriate domain name to the resolver search list without jailbreaking?

share|improve this question
I found a workaround, although not ideal: you can manually add additional search domains per network in wifi settings:… – jgor Jul 7 '11 at 21:14
Why not just connect by the IP address and save all of the other rigamarole? – SaxDaddy Jul 31 '14 at 0:53
@SaxDaddy for instance there are cases where you need more than one local domain simultaneously. – Monkey King Oct 7 '14 at 17:06
@SaxDaddy because sometimes you get into CORS issues when you access javascript from elsewhere than the domain it was meant to run from. – frandroid Dec 2 '14 at 17:33


See this answer on stackoverflow.

share|improve this answer

No, but as a work-around, you could have your iPad proxy to a Mac on your home LAN and then do the DNS trickery there.

(I'm assuming that you need this ability during debugging/testing, not "everywhere.")

share|improve this answer
Perhaps if you stayed on a VPN, you could maintain that DNS trickery on the go? – andrewb Nov 19 '15 at 23:31

Use Weblock - AdBlock for iOS app to create a redirect rule from http://app to the IP and port you like.

(Only works when on a WIFI network)

share|improve this answer
Took me a little while to figure out how to make this work, but this is a great solution. Thanks! – Lea Hayes Dec 8 '14 at 18:40

In general, editing the Hosts file is a bad solution. I only use it for temporary testing, and always remove any hosts file entry a few minutes after adding it.

You should be using a DNS server of some kind to setup your custom domain, perhaps this is possible with your wifi router, or else you can set up any mac as a DNS server.

As a nice side benefit, having your DNS server on the LAN will make your internet noticeably faster. Most people are using their router as a DNS server and they really are not fast enough to implement DNS properly. It's a good idea to use a fast remote DNS server (which one is best will depend on what city you live in), but having one on your LAN is even better.

You can google for instructions how to setup bind on any mac, it's free. Or you can purchase Lion Server from Apple in the App Store, and download Server Admin Tools to configure bind with a nice GUI (with Lion, unlike Snow Leopard, you have to download Server Admin Tools separately form buying a license for Mac OS X Server. Basically they've separated the advanced server tools out into a separate download from the basic ones).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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