Reverse port forwarding – Mobile Web Development

Reverse port forwarding – Mobile Web Development


Now all of these examples, we’re accessing a live site. But you can also setup Port Forwarding to allow your mobile device to access a local server on your development machine over USB. Let’s take a look. To do this, you want to make sure you have a server running on your local development machine. In this case, I’m going to use Python’s simple HTTP server on Port 9999. Now to verify that it is actually working, I’m going to access that on the local machine and it’s working fine. If I want to now access that same page on my mobile device, I need to set up Port Forwarding. I can go back to the Chrome Inspect page, click on Port Forwarding and set up a port forwarding rule. In this case, port 9999 on local host or IP address 127001. I enable Port Forwarding and click on Done. When I refresh this page, you’ll see that Port Forwarding is now running on Port 80 80, and 99 99. At this point, we’re all set up. So let’s try it out. I’ll open a new tab, navigate to localhost 9999 on the mobile device. And voila, the page is ready to go.

3 Comments

  1. You can use port forwarding to access a server on your LAN, not just a server on your local machine. Map port 8080 to 192.168.1.x:80 were x is the exact IP of your web server machine. Setup a virtual host for incoming requests to 'localhost' on your remote server. On the mobile device localhost:8080 will pull pages from the remote server by proxy via your desktop machine.

Leave a Reply

Your email address will not be published.


*