Using ngrok's inline request inspection for local debugging
Ngrok tunnels local ports to a public URL and shows request details at 127.0.0.1:4040. This post covers HTTP inspection, TCP tunneling, and free-tier limits for debugging.
15 Sept 2026, 16:38 UTC

The problem: debugging locally without public access
When you need to test a webhook, receive a third-party API call, or debug a local service from outside your machine, the immediate hurdle is exposure. Your laptop sits behind NAT, firewalls, or dynamic IPs. Port forwarding helps, but it is often impractical for temporary or frequently changing ports. This is where a tunneling tool becomes essential.
ngrok's inline HTTP request inspection
Ngrok provides a lightweight binary that creates a public URL pointing at your local address. Once running, visit the inspection UI at 127.0.0.1:4040. It reveals a real-time log of every request that passes through the tunnel. You will see the method, path, headers, a summary of the body, and timing metrics—all without adding print statements or modifying code.
starting a basic HTTP tunnel
ngrok http 8080
Run this command in a terminal where ngrok is installed. No special permissions are required beyond executing the binary. After it starts, ngrok prints the forwarding URL (e.g., https://abcd1234.ngrok.io) and the inspection UI becomes available at 127.0.0.1:4040.
what the UI shows
- request method and path
- full header breakdown
- body size and content type preview
- request and response timing
replaying requests for iterative testing
The inspection UI includes a replay feature. Select a previous request from the list, adjust headers or query parameters if needed, and resend it to your local endpoint. This is useful for verifying how your code handles different payloads, error conditions, or edge cases without re-creating the original scenario from scratch.
tcp tunneling for non-http services
Not everything runs over HTTP. Databases, game servers, or custom protocols often listen on TCP ports. Ngrok's ngrok tcp command exposes those ports similarly. For example, ngrok tcp 5432 forwards PostgreSQL traffic to the internet. The same inspection UI appears, showing connection attempts, protocol metadata, and duration.
example: exposing a local postgres server
ngrok tcp 5432
Run the command in a terminal. The UI at 127.0.0.1:4040 will list incoming TCP connections with source IP, port, and duration. Note that TCP inspection shows connection metadata rather than request/response bodies, since the protocol is not HTTP.
limitations and practical checks
- Free-tier session timeouts. Idle tunnels terminate after eight hours of inactivity. If your debugging session runs longer, restart the tunnel or use a Pro plan for always-on endpoints.
- Rate limiting and unexpected termination. Free tunnels may be throttled or dropped without notice, especially under sustained traffic. Keep sensitive debugging offline when possible.
- Version-specific features. Not every ngrok release exposes the same UI capabilities or TCP support. Check ngrok version and consult the documentation for your exact build.
getting started safely
Start by installing ngrok and running ngrok http PORT. Open the provided URL in your client code, and visit 127.0.0.1:4040 to inspect the traffic. If you are debugging a TCP service, use ngrok tcp instead. Always restrict access with auth tokens or firewall rules when exposing internal services, and remember that free-tunnel URLs change each session unless you configure a reserved domain on a paid plan.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.