Public Tunnels
Public tunnels offer a secure and efficient way to connect local servers to the wider internet. These tunnels enable developers to share, test, and collaborate on web applications directly from their local environments. By creating a bridge between a local server and a public endpoint, public tunnels facilitate real-time demonstrations, remote testing, and seamless integration of webhooks and services.
Introduction to Ngrok
Section titled “Introduction to Ngrok”Ngrok is a multiplatform tunnelling, reverse proxy software that enables you to expose a web server running on your local machine to the internet. We use this tool in building, testing, and sharing applications. It’s also handy for quickly demonstrating our work to clients or colleagues for real-time feedback.
When Might You Use Ngrok?
Section titled “When Might You Use Ngrok?”We primarily use public tunnels for the following reasons:
- Demoing Websites: Allows us to share a public URL of their localhost server with clients or teammates.
- Testing Mobile Applications: Facilitates on-device mobile app testing by exposing a local web server to the internet.
- Webhooks Development: Essential for developing features that require a public URL for webhooks on a local server.
Step-by-Step Guide to Setup Ngrok
Section titled “Step-by-Step Guide to Setup Ngrok”Step 1: Install Ngrok via Homebrew
Section titled “Step 1: Install Ngrok via Homebrew”- Command:
Terminal window brew install --cask ngrok
Step 2: Restart Your Terminal
Section titled “Step 2: Restart Your Terminal”- Ensure all changes are applied by restarting your terminal after installation.
Step 3: Run Ngrok
Section titled “Step 3: Run Ngrok”- Command:
Replace
Terminal window ngrok http PORT_YOUR_LOCAL_INSTANCE_IS_RUNNING_ONPORT_YOUR_LOCAL_INSTANCE_IS_RUNNING_ONwith your specific port number.
Running Ngrok for Pow Sites
Section titled “Running Ngrok for Pow Sites”- If using Pow, a zero-config Rack server for Mac OS X, use the following command:
Replace
Terminal window ngrok http -host-header=example.dev example.dev:80example.devwith your specific Pow site.
For more detailed information on using ngrok, visit their official documentation here.