Developing software in the Real World

Using ngrok to test on a mobile

To test a website that you're developing on your local computer on a mobile device such as a phone or tablet use ngrok.

This is the way to do it:

  1. Start up ngrok: $ ngrok http my-dev-site.local:80
    This will start up ngrok and give you a "Forwarding" URL such as http://24f55bf5.ngrok.io.
    In this case, it will direct all traffic to that URL to http://my-dev-site.local. If you run
    your website on a different port, such as http://localhost:8888, then use $ ngrok http 8080
    instead.
  2. If your website's base url is configured in a config file, then update it to be the Forwarding URL.
  3. Go to the Forwarding URL (http://24f55bf5.ngrok.io, in this example) on your mobile and test!

It's not hard to do this, but this will save me having to look it up next time!


Also published on Medium.

Leave a Reply

Your email address will not be published. Required fields are marked *