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?
Best Answer
It's been two years after the last comment & I've no idea if the OP will even read this or still needs a solution; however, for anyone who may have been led here via a search engine, the answer is yes, though not directly. Let me attempt an explanation. Editing the actual
/etc/hosts
file of a non-jailbroken iOS or iPadOS device isn't possible. However, as was alluded to in previous comments, you can use a local VPN. By local, I mean a device-only VPN as there is no need for a LAN server - excepting the security, privacy, speed, & fun that running a local DNS server would give you. Since the VPN opens up the "space" to use not only custom hosts files, but also allows you to connect to any, including private, DNSCrypt v1 or v2 servers, DNS over HTTPS (DoH) servers, or DNS over TLS (DoT)(1) servers with or without a custom hosts file, whether the hosts file is used as an extra layer of device security & privacy, for blocking the seemingly greater & greater number of ads on iDevices, or for the OP's desired purpose(2). Apple had been vague regarding the rules regarding App Store acceptance & in fact has rejected Apps due to a "lack of entertainment value", even if the rejected App is of practical use. Now, in order to detail the methods used to use a custom hosts file on a non-jailbroken iPad, I have to refer to specific Applications; I am not connected to any of the three Apps nor their developers beyond being a Beta Tester for one of them & a former Beta Tester for two of them, both of which no longer conduct beta testing. I'll use the list below to detail the relevant information: cost; DNS; stability; customization.Note: each of the three apps show all incoming and outgoing DNS requests, which is helpful to, e.g. block specific traffic from ever leaving or reaching your device.