DEV Community

Cover image for Chrome DevTools: Port forwarding allows localhost URLs to work on mobile
odd developer
odd developer

Posted on

Chrome DevTools: Port forwarding allows localhost URLs to work on mobile

Port forwarding lets you view your local website, even it's hosted on a custom domain, directly on your android device.

Chrome to Phone my localhost URL from desktop
Remote Debug the mobile localhost page and enable port forwarding
Refresh and observe that no command line was needed!

  1. Set up remote debugging between your development machine and your Android device. When you're finished, you should see your Android device in the list.

  2. Click Port forwarding button. localhost:8080 is set up by default.
    Alt Text

  3. Check Enable port forwarding. If you want to set up other ports, follow the steps 4 and 5. Otherwise skip to step 6.

  4. In the Port textfield on the left, enter the localhost port number from which you want to be able to access the site on your Android device. For example, if you wanted to access the site from localhost:5000 you would enter 5000.

  5. In the IP address and port textfield on the right, enter the IP address or hostname on which your site is running on your development machine's web server, followed by the port number. For example, if your site is running on localhost:7331 you would enter localhost:7331.

  6. Click Done.

You can read the full procedure on the official DevTools Documentation

Discussion (0)