This tutorial demonstrates a way to share your localhost development server with anyone, anywhere using ngrok to create a secure tunnel to your local machine.
Demonstrating your application’s latest features to project managers or clients isn’t easy unless they’re sitting a few desks away. It may be possible to commit the changes and deploy to a public staging server, but that process can be impractical if you’re just seeking an opinion about a widget color or demonstrating the futility of their ridiculous suggestion!
Ideally, you need some way to share access to a web application currently running on your
localhost development server. ngrok provides that solution.
What is ngrok?
Your development machine may be connected to a secure network behind a firewall. To work around access restrictions, ngrok runs a small client process on your machine which creates a private connection tunnel to the ngrok cloud service. Your
localhost development server is mapped to an
ngrok.io sub-domain, which a remote user can then access. There’s no need to expose ports, set up forwarding, or make other network changes.
The ngrok client software is available for Windows, macOS, and Linux.
Is ngrok Secure?
The connection tunnel established by ngrok is secure and can only transmit data to the
localhost port you have open. It would be difficult to do any damage, but ngrok is only as secure as the application you’re testing.
In most cases, you’ll use ngrok to temporarily grant access to someone by issuing them with a randomly generated URL. It’s best to assume that anyone could access your app while the tunnel is open. You may want to disable that “delete all files” option while ngrok is active!
What Does ngrok Cost?
The basic ngrok service is free and permits up to four tunnels and 40 connections per minute. Commercial options start from $5 per month, providing further connections and custom domains.
To start, open ngrok.com in your browser and click Sign up to register. A Google or GitHub account is easiest, but you can choose standard registration with an email address and password. An email verification link will be sent to you.
After login, you’ll be directed to the ngrok dashboard where you can download the client for your operating system.
Download and extract the file, following any specific instructions for your OS. It’s then necessary to add your authentication token by running the command shown in the Connect your account section a little further down the page.
./ngrok authtoken <token>
Note: Windows users will enter
How to Use ngrok to Share a Local Development Site
Source: Site Point