Hello, it is required to distribute the Internet to the phone (Samsung Galaxy S5) from a laptop (Windows 7 64bit). The application on the phone accesses the server ( http://server.ru for example), you need to redirect all requests to the local virtual web server (Denwer or OpenServer) (127.0.0.1 server.ru). Tell me how to competently implement it.

  • one
    Start a DNS server on the laptop, configure it to issue the IP address of your laptop instead of the real one for the domains you need, register using this dns server on the phone. - xkor
  • I installed a certain unbound (dns server), I can not figure out how to set the ip for the domain - LorDo
  • judging by the documentation, add to the config something like local-data: "server.ru A 192.168.1.10" - xkor

1 answer 1

I can recommend using the fiddler program on a laptop. This is an incredibly useful thing in web development and, in particular, is perfect for solving your problem. The program is easy, easy to use and free in the full version.

Briefly

Install the fiddler program on the laptop. After launching, it creates a proxy server on the computer through which all requests begin to go (of course, so far only all requests of the computer itself). In addition to your task, the program can be used for debugging purposes in web development. There are such convenient tools as repeat requests or substitute response and filtering and much more. We put a tick in the settings so that the proxy works on the external ip-address, after which it remains only in the wi-fi-connection settings on the device to configure the proxy on our computer (fill in two fields). Now all requests go through the computer, taking into account its DNS. Those. On the phone, all the rules of hosts from the laptop will work.

Read more

To install

We go to the official site , click the "Free download" button, specify the email, remove the checkbox from "subscribe", put a checkbox on "I agree with the conditions ...", download. Installation requires no explanation. After installation, if dialog boxes appear, we poke "no" (it seems to offer something like a toolbar for IE).

Fiddler setup

Run the program. Immediately after starting it starts working and you see requests appearing in the list. But we are not interested and we go to the settings:

Tools -> Telerik Fiddler Options -> Connections

Here we see on which port the proxy works (by default 8888), it will be useful to us on the phone. Below we set Allow remote computers to connect , click OK, after which the program reports that the settings will take effect after the restart. Close the program and open it again. That's it, the proxy is ready to go.

fiddler settings for proxy work on external ip-addresses

Setting up a proxy on the phone

We go on the device in the Wi-Fi-connection settings. Not the Wi-Fi settings in general, but the settings of the current connected network. There we find something like "advanced settings" in which the proxy settings should be. Maybe they are not hidden in the "extended" and shown immediately. In the field " Proxy host name " or "Proxy address" or something similar, you need to enter the ip-address of our laptop in our subnet. In the " Port " field you need to enter the port that we saw in the fiddler settings (by default - 8888 ).

Here are my settings:

proxy settings on android phone

Is done

Now all requests to the Internet from the phone go through your proxy server on the laptop. All the rules specified in the hosts on the computer are taken into account and the phone will open your local site. Moreover, you will see every request from the phone in the fiddlere. In addition to the settings in the hosts, you can change the DNS records in the same way in the fiddler itself. To do this, you can go to the Tools -> HOSTS... section Tools -> HOSTS... and write the rules there. They will no longer act, of course, when you turn off the program, in contrast to the rules added to the hosts file.

When you want to return the phone to the normal Internet, you need to disable the proxy in the wi-fi settings on the phone. Turning off the program on the laptop without disabling the proxy on the phone will lead to loss of communication on the device.

Fiddler & https

If I'm not mistaken, by default, fiddler does not handle https requests, and therefore does not interfere with https operation, but it does not allow debugging SSL traffic. If you wish, you can enable Decrypt HTTPS traffic in the settings, but after that you will have to regularly add “exceptions” to the list, because various well-protected queries that fiddler did not cope with and constantly respond “yes yes, I understand everything” will fall in bulk Chrome's frightening warnings about an "untrusted certificate." But, despite some inconvenience, you can sniff your SSL-traffic, if such an opportunity is required.

  • one
    For https, it is enough to install the certificate 192.168.1.3:8888/FiddlerRoot.cer in the system (you can open it in the browser 192.168.1.3:8888 there will be a link to it) and no one will swear again. This can be done both on the desktop and on the phone, everything will work ... - Yura Ivanov
  • @YuraIvanov thanks for the info! This is exactly what I missed so much) - Ivan Pshenitsyn