ngrok tunneling for local development¶
Ngrok is a reverse proxy tool that creates a secure tunnel from a public URL to a locally running web server^[400-devops__000-MOC-devops.md]. This allows developers to expose a local development environment to the internet, which is essential for testing webhooks, sharing demos, or accessing applications from mobile devices without deploying to a public server^[400-devops__000-MOC-devops.md].
Core Functionality¶
In a standard development setup, applications run on localhost and are inaccessible to the outside world^[400-devops__000-MOC-devops.md]. ngrok acts as a proxy server that bridges this gap^[400-devops__000-MOC-devops.md]. By running ngrok on the same machine as the development server, it generates a public forwarding URL (e.g., https://random-id.ngrok-free.app). Traffic received on this public URL is forwarded through the tunnel to the specific port (e.g., 8080 or 3000) where the local application is listening^[400-devops__000-MOC-devops.md].
Common Use Cases¶
- Webhook Testing: Local servers cannot receive webhooks from external APIs (like Stripe or GitHub) because those services cannot reach
localhost. ngrok provides a public URL that can be registered in the external service's dashboard to forward events directly to the local debugger^[400-devops__000-MOC-devops.md]. - Mobile Development: Developers can view their local site on a physical smartphone or tablet by entering the ngrok URL in the device's browser, rather than relying on emulator limitations.
- Demonstration: It enables quick sharing of work-in-progress features with stakeholders or clients without the overhead of a full deployment^[400-devops__000-MOC-devops.md].
Key Features¶
- Secure Tunnels (HTTPS): ngrok automatically provides HTTPS endpoints, ensuring that the connection between the client and the ngrok server is encrypted, which is often required by modern APIs and browsers^[400-devops__000-MOC-devops.md].
- Bypassing Firewalls: It eliminates the need to configure router port forwarding or complex firewall rules, as the connection originates from inside the local network^[400-devops__000-MOC-devops.md].
Related Concepts¶
- [[Reverse Proxy]]
- [[Local Development]]
- [[Port Forwarding]]
- [[Webhook]]
- DevOps
Sources¶
400-devops__000-MOC-devops.md