DEV Community

overnight.technology
overnight.technology

Posted on

Testing Stripe webhooks on localhost without leaving the URL open to everyone

Most localhost tunnels hand you a public URL that anyone can hit. That's fine for a quick demo, but when you're testing Stripe, GitHub or Slack webhooks against your laptop, an open URL means random scanners reach your dev server too.

Here's the setup we use with overnight.technology Tunnels, where every link is locked by default.

1. Install the client

curl -fsSL https://app.overnight.technology/install.sh | bash
export PATH="$PATH:$HOME/.local/bin"
ot login --token YOUR_API_TOKEN
Enter fullscreen mode Exit fullscreen mode

It installs the open-source frp client plus a small ot script into ~/.local/bin. The client keeps an outbound connection, so you open no ports on your router.

2. Start a tunnel with your own secret

ot http 4242 --slug hooks --secret a-long-random-string
Enter fullscreen mode Exit fullscreen mode

Your app on port 4242 is now reachable at https://hooks.overnight.technology, but only with the secret (header X-OT-Tunnel or ?ot=). Everyone else gets a 401 before a single request reaches your machine.

3. Register the webhook

In the Stripe dashboard, add the endpoint:

https://hooks.overnight.technology/webhook?ot=a-long-random-string
Enter fullscreen mode Exit fullscreen mode

Keep verifying Stripe's signature in your app as usual; the tunnel secret is an extra gate in front, not a replacement.

4. Watch deliveries

Each tunnel keeps a request log of the last 200 requests (time, method, path, status), so you can see whether Stripe got a 200 or your handler threw.

Extra locks

  • --basic user:pass for client demos (the browser asks for a password)
  • --allow 203.0.113.7,10.0.0.0/8 to restrict to your office IP, on top of the token
  • The slug belongs to your account, so the URL stays the same after restarts

Limits, honestly

Tunnels carry HTTP(S) only today: no raw TCP/UDP, no WebSockets or streaming responses, no custom domains on tunnels yet, no Windows installer. Plans start at €9/month, and access is on request for now.

Docs: https://overnight.technology/docs/tunnels/

Top comments (0)