Apple - Add a hosts file entry without jailbreaking
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)
No.
See this answer on stackoverflow.
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.
- DNSCloak: Free; DNSCrypt v1&2, DoH; stable, very customizable including being able to (2)forward IP addresses via DNS & do CNAME flattening.
- AdGuard Pro $4.99USD; stable, DNSCrypt v1; customizable.
- AdGuard Basic functions are free, everything else costs. Currently beta tested, which gives you everything at no cost beyond some of your time on GitHub. This is the only App that enables the use of (1)DoT. Both built-in and custom servers may be used; semi-stable; customizable.
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.