How can I redirect HTTP requests made from an iPad?

前端 未结 17 2312
后悔当初
后悔当初 2020-12-12 09:53

Since on an iPad we cannot edit the hosts file (without jailbreaking), how can we arbitrarily redirect web traffic to another url?

This would be important for someth

相关标签:
17条回答
  • 2020-12-12 10:13

    Here is a no configuration method for cross device/computer testing of a Mamp Pro Virtual host. The only limitation is you can only test one domain at a time, but for me this is fine when I'm developing. It is really simple however to change between virtual hosts directly in mamp.

    Im running mamp pro 2, mountain lion. My sites folder contains the individual domain folders.

    I found if you choose the specific ip of the local computer under the virtual host 'ip /port' and restart mamp this domain will become the default domain when viewing the localhost computers' ip address, or computer name, across the network.

    For testing purposes this works great across all devices on the network, including the iPad. If you want to test another virtual host you can simply return the ip/port config to "*" and then reassign another domain to the computers ip address and restart.

    The advantage of this simple approach is you can provide access to clients directly to your development sites when your on the same network without having to go through any configuration on their machine.

    Hope this helps anyone else looking for simple solution.

    0 讨论(0)
  • 2020-12-12 10:16

    The way to get around this limitation of the iPad is to use a HTTP proxy server, such as Squid running on another machine where you can edit the hosts file.

    On the iPad Under Settings -> Network -> Wi-Fi -> (Your network) There is a HTTP Proxy setting which can be set to manual. Enter you proxy information here.

    Once this is set up you would be able to manipulate the iPad as if you were changing the hosts file.

    0 讨论(0)
  • 2020-12-12 10:20

    Answers herein are correct. A bit more knowledge: These will not work with cert pinning. What you can do is either (1) use a domain wildcard cert to support your dev/test/qa region testing. And/or (2) use a reverse proxy server such as Apache whereby you change to where Apache routes the requests within your network. Now, when you get into SSL Pinning testing then you are dead in the water with the physical devices and can only validate with simulator (ios) and emulator (android).

    0 讨论(0)
  • 2020-12-12 10:21

    Using custom DNS server on PC can solve this. I'm using and working perfectly.

    Check https://technitium.com/dns/ to download custom DNS server. Which is built using .Net technology. After configuring this tool, you need to change DNS setting to custom and set IP of your PC. To avoid changing IP every time when you restart PC, use static IP on PC.

    0 讨论(0)
  • 2020-12-12 10:23

    Setup the hosts file on a computer running a proxy server such as Fiddler or Charles, and configure the iPad to use that computer as an HTTP proxy.

    Here are instructions for how to do this with Fiddler: http://conceptdev.blogspot.com/2009/01/monitoring-iphone-web-traffic-with.html

    And this is for Charles: http://www.ravelrumba.com/blog/ipad-http-debugging/

    0 讨论(0)
  • 2020-12-12 10:23

    I need to test web apps I am developing on an iPad. I use Apache on my dev machine to run the web apps, so the easiest solution I found was to use Apache mod_proxy.

    My dev machine is visible on my home network as sapphire.local.

    The web app I am testing is at hosted on the dev machine at demo.cms.dev (I am using POW).

    To setup the proxy, I added the following section to httpd.conf.

    <VirtualHost *:80>
      ServerName sapphire.local
      ProxyPass / http://demo.cms.dev/
      ProxyPassReverse / http://demo.cms.dev/
      ProxyPassReverseCookieDomain .cms.dev .sapphire.local
      ProxyPreserveHost Off
    </VirtualHost>
    

    This routes incoming requests on sapphire.local to demo.cms.dev. The method only works for one app at a time. I think you could use different ports to setup additional apps. Maybe someone has a better solution?

    0 讨论(0)
提交回复
热议问题