Local forwarding
Local forwarding is a Pro feature. The CLI opens a WebSocket to HookNexus for your endpoint; each incoming webhook is replayed as an HTTP request to the URL you specify—ideal for local development without exposing a public URL.
How it works
- You run
hooknexus forwardwith an endpoint ID and a--totarget (normallyhttp://localhost:...). - The CLI maintains a live WebSocket subscription for that endpoint.
- When HookNexus receives a webhook, the CLI forwards the method, headers, query string, and body to your target.
- Responses are summarized in the terminal (status code, timing, truncated body).
Identification headers such as X-Forwarded-By, X-HookNexus-Request-Id, and X-HookNexus-Original-IP are added so your app can tell forwarded traffic apart.
Basic usage
hooknexus forward EP_ID --to http://localhost:3000/webhookReplace EP_ID with your endpoint’s ID from the dashboard or hooknexus endpoints list.
Path mapping
By default, the request is sent to the exact URL you pass to --to. To append the path that followed /h/<endpoint-id> in the original request, use:
hooknexus forward EP_ID --to http://localhost:3000 --preserve-pathThat way, extra path segments on the public webhook URL are preserved on your local server.
Multiple endpoints
Run one forward process per endpoint, each in its own terminal (or process manager), with its own --to URL. There is no single command that forwards several endpoints to different targets in one process.
For listening only (no HTTP forward), you can use hooknexus listen with multiple endpoint IDs or hooknexus listen --all.
Timeouts, headers, and non-local targets
| Option | Purpose |
|---|---|
--timeout <ms> | HTTP timeout when calling your local server (default often 30s). |
-H "Name: Value" | Extra headers to add to the forwarded request (repeatable). |
--allow-external | Allow --to to point outside localhost (use with care). |
--insecure | Relax TLS verification when needed for local dev (see CLI help). |
Retry and resilience
- WebSocket: If the connection to HookNexus drops, the CLI attempts to reconnect automatically.
- HTTP forward: A failed forward (connection refused, timeout, etc.) is reported in the terminal; automatic retries for the same webhook are not guaranteed—fix your local server or trigger the webhook again from the provider.
Use cases
- Local API development — Point Stripe, GitHub, or Shopify webhooks at HookNexus, then forward into
localhostwhile you iterate. - Integration tests — Hit a stable public URL in CI or staging while your handler runs on your machine.
- Debugging payloads — Combine forwarding with dashboard or
hooknexus listento compare raw vs forwarded behavior.