// ERR_NGROK_3022

ngrok ERR_NGROK_3022 — local server not reachable: how to fix

ERR_NGROK_3022 means ngrok received a request, dialed your local server, and got a connection refused (or a timeout). The tunnel is up; the destination isn't.

What it means

ngrok's agent tried to forward the inbound request to whatever you bound at startup (e.g. localhost:3000) and failed. Either nothing is listening on that port, the process exited, or the address you handed ngrok was wrong.

Common causes

  • Your dev server crashed or exited.
  • You started ngrok before starting the local server.
  • You bound the local server to 0.0.0.0 but ngrok is dialing 127.0.0.1 (or vice versa).
  • The port number passed to ngrok doesn't match what your server actually listens on.

How to fix it on ngrok

  1. 1. Verify the local server is up

    $ curl -i http://localhost:3000 | head -5
  2. 2. Restart the local server, then ngrok

    If you started ngrok first, kill it and re-run after the server is listening.

  3. 3. Bind to 127.0.0.1 explicitly

    Some setups (Docker bridge, IPv6-first hosts) trip on 'localhost'. Bind your dev server to 127.0.0.1 and pass the same to ngrok.

    $ ngrok http 127.0.0.1:3000

// the same workflow on lrok

lrok's agent prints 'connection refused at 127.0.0.1:3000' verbatim from the OS, not a numeric code. Half the bug is naming the bug — when the error message tells you the port and the reason, fixing it is a 5-second job.

  1. 1. Start your local server first

    $ npm run dev   # listens on :3000
  2. 2. Then tunnel

    $ lrok http 3000
  3. 3. Watch the agent stderr for live errors

    When the local server goes down mid-session, the agent reports it immediately and reconnects when the server returns.

More ngrok issues