How to expose localhost to any device using Ngrok

6th August 2021

0

Page Index

    Share

    Want to know how you can easily test your design without deploying or hosting it anywhere?

    Use ngrok.io to expose your localhost

    How it works

    Install

    Go over to the ngrok download page. It will automatically detect your OS and show you the option to download the binary file. Unzip the downloaded zip file, you can find the executable there.

    Sign in to ngrok

    You need an authtoken to use the service. Sign up is easy. In your dashboard you will find the code to run the token.

    $ /path/to/ngrok authtoken <YOUR_AUTH_TOKEN>

    The /path/to is easy, if you can just move or copy the binary to your home directory or run ./ngrok authtoken <YOUR_AUTH_TOKEN> from the directory the file resides.

    Starting ngrok

    Now if you have your server running at http://localhost:3000 then run

    ./ngrok http 3000

    That's it. You will get the process running status and urls like this:

    console and mapping of urls

    You'll get http as well as https connection to the webserver.

    Hope you'll find something useful here.
    Frontend developers can find this very useful to access a variety of mobile devices anywhere as long as the connection is alive. One thing to remember is that in the free plan we don't get to choose a custom domain. But that's okay in most cases.

    About the Author

    Related Blogs

    View All Blogs
    No blogs!

    Want #swag?

    Join our monthly raffle!

    Every month, One Lucky Duck gets free swag shipped to their doorstep, wherever in the world you are! All you have to do is join our Discord channel today and tweet about the amazing things we do. #nullcast #luckyduck

    We will announce the winners on Twitter and through our discord channel.

    Duck