How do I change my iPhone hosts file to access a development server?

Johnny March 16, 2015
Pinterest Stumbleupon Whatsapp
Ads by Google

I am a web developer. When accessing a development server on a desktop computer containing a test website, one need only edit the hosts file and point the URL to the development server IP address.

What are my options if I wanted to do the same on a mobile device which hasn’t been rooted or jailbroken?

I’ve searched online and all I could find was a commercial app called Charles (http://www.charlesproxy.com/). I would like to find a free solution or one that doesn’t require additional applications.

  1. Reahubber
    March 25, 2015 at 11:58 pm

    It is not a good practice to tweak phone iptable. I would suggest something else. Since you are developer so I assume you must be having router to use internet on phone , laptop , desktop. Just configure your wireless router to forward connection. That way you don't need to change it separately for phone or laptop. It will work for all.

  2. ha14
    March 16, 2015 at 5:55 pm

    maybe the following can help?

    Weblock - AdBlock for iOS
    https://itunes.apple.com/us/app/weblock/id558818638?mt=8
    create web traffic redirects

    Using SquidMan to snoop iOS HTTP requests
    http://tinnedfruit.com/2011/03/10/using-squidman-to-snoop-ios-requests.html

    http://xip.io/

    Mobile Proxy Generator
    http://iphonesettings.net/mobileproxygenerator.php

  3. Jan F.
    March 16, 2015 at 5:53 pm

    Without spending any time researching I am confident to tell you that it won't be possible without jailbreaking your device. (Being able) To modify the hosts file is a big security risk. Something that goes straight against the security model of iOS.

    Therefor using a proxy or a specific DNS server is pretty much the best I can think of. Some options from the top of my head:
    http://www.privoxy.org/
    http://dhcp-dns-server.sourceforge.net/
    http://www.thekelleys.org.uk/dnsmasq/doc.html
    http://www.vercot.com/~serva/