Test GitHub Webhooks on Localhost
Setup
# Terminal 1: your app with webhook handler
npm run dev
# Terminal 2: tunnel
npx localtolink --port 3000
Configure GitHub webhook
In your repository → Settings → Webhooks → Add webhook:
| Field | Value |
|-------|-------|
| Payload URL | https://YOUR-SUBDOMAIN.localtolink.com/api/github/webhook |
| Content type | application/json |
| Secret | Your webhook secret (verify in handler) |
Replace YOUR-SUBDOMAIN with the subdomain LocalToLink prints.
Verify signatures
GitHub sends an X-Hub-Signature-256 header. Verify it in your handler:
import crypto from "crypto";
function verifySignature(payload, signature, secret) {
const hmac = crypto.createHmac("sha256", secret);
const digest = "sha256=" + hmac.update(payload).digest("hex");
return crypto.timingSafeEqual(Buffer.from(digest), Buffer.from(signature));
}
Test delivery
Use "Recent Deliveries" in the webhook settings to replay events or check response codes.
Notes
- GitHub webhook POSTs are server-to-server — no browser interstitial
- Update the Payload URL when you start a new tunnel session (new subdomain)
- Session limit: 2 hours
- LocalToLink has no request inspector — use GitHub's delivery logs for debugging
See Test Webhooks Locally for the general webhook hub.
Try it now
Start a tunnel from your project directory — no account required.
$ npx localtolink