Pragmatism 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!

3 thoughts on “Using ngrok to test on a mobile

  1. I have tried that. I have tested my chat application on two different laptops (using ngrok) and the session was working perfectly fine. But when I opened the URL on my mobile and joined the chat session then I was unable to join that session. My project is based on node.js and socket.io.

Comments are closed.