Reputation: 11886
I'm trying to setup Chrome mobile debugging using an Android phone and a USB connection.
I have managed to get the device available in chrome://inspect/#devices
and can inspect remote sites e.g. www.google.com, etc.
However, I would like to test a local site/app running on a local server e.g. http://my-local-server, etc. I tried the port-forwarding feature, but I can only access localhost, not a local domain.
Am I able to do this without the somewhat complicated Proxy/Wi-fi setup?
Upvotes: 0
Views: 2481
Reputation: 544
Hi this is possible with Drony. Instructions to download and first configuration are in this answer https://stackoverflow.com/a/75214767/13720928.
Follow further directions here:
Filter default value -> Direct all
to direct all connections to where the're supposed to be requested
mylocalsite.net
.
Action -> Allow
and click on save
Log
tab turn on DronyEnjoy browsing while developing your app! Or develop your app while accessing both localhost and another api service.
Upvotes: 0
Reputation: 11886
I managed to find a solution.
Before you attempt this, setup port forwarding for Chrome mobile debugging and keep track of the ports. Let's call them:
proxy.js
in a directory of your choiceproxy.js
PORT_LISTEN=8090 PORT_TARGET=80 HOST_TARGET="my-local-server" HOST_ORIGIN="my-local-server" node proxy.js
What's happening is as follows:
localhost:8090
HOST_ORIGIN
indicates to the web server who the request is for i.e. my-local-server
localhost:6040 --> localhost:8090 --> my-local-server:80
On your device, you should now be able to visit http://localhost:6040
and see your local server/domain site.
Upvotes: 0