I have an iPad that needs to be able to connect to a server via its short hostname, e.g. http://app instead of http://app.example.com. The network it connects to assigns it a domain name other than example.com 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?

  • 2
    I found a workaround, although not ideal: you can manually add additional search domains per network in wifi settings: techinch.com/2011/02/04/… – 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
  • 1
    @SaxDaddy for instance there are cases where you need more than one local domain simultaneously. – Mark 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

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)

  • 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
  • Worked for me! The only gotcha is: you need to use the wildcard syntax given, so if you would like to redirect app.myserver.local to, then the correct syntax is: Redirect URL: *.myserver.local/*; Proxy IP:; Proxy port: 80 (or 8080) – aron.lakatos Sep 6 '16 at 14:11
  • Can anyone confirm if this is still possible via this app? – RwwL Jan 4 '19 at 19:58


See this answer on stackoverflow.


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.")

  • 1
    Perhaps if you stayed on a VPN, you could maintain that DNS trickery on the go? – andrewb Nov 19 '15 at 23:31

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


Actually, there is a way. Create your own app including a network extension that filters DNS queries using NEPacketTunnelProvider and parsing IP packets manually. I already have it, working perfectly, and will upload it in a few days. I will add the possibility to upload host files too. Although 7 years ago this was not technically possible.

  • 2
    sounds awesome. Where did you upload? – Andrew Steitz Nov 14 '18 at 16:45
  • Do you have link to Github? – Kryštof Matěj yesterday
  • @KryštofMatěj I got the app working months ago, but Apple rejected it telling me that it was forbidden to use NEPacketTunnelProvider for creating dns blockers, filtering or ad blockers. So, nothing we can do. – Ricardo yesterday
  • I do not need app from AppStore. If you provide me source codes I will add my hosts file from mac to your app and build it directly to my phone. – Kryštof Matěj yesterday
  • @KryštofMatěj You can use an extension (NEPacketTunnelProvider) that loads a hosts file and redirects everything you want. But apple does not allow to do that. So, it is a waste of time. – Ricardo yesterday

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .