Overview
ngrok is an HTTP tunneling tool. It can be used to expose a locally running server to the outside world using HTTP or HTTPS.
ngrok has Free, Pro, and Enterprise tiers. Basic usage is free.
Steps to Use
- Sign up for an account at ngrok.
- Login at the same URL.
- Download an OS-specific version of the
ngrok
command. - Copy your auth token from the "Setup & Installation" page.
- Authenticate with ngrok by entering the command
ngrok authtoken {your-auth-token}
- Start any local server that listens on a given localhost port.
- Create a tunnel by entering the command
ngrok http {local-port-number}
- In the output of this command, copy the URL after "Forwarding". Note that there are two to choose from: one for
http
and one forhttps
. - Use the copied URL from any device to send HTTP requests to the local server.
A limitation of the Free tier is that the forwarding URLs are ephemeral, meaning they change each time the ngrok
command creates a new tunnel. Code that uses an ngrok URL must be modified to use the new value. The Pro and Enterprise versions can use a custom domain, removing this burden.