ngrok

https://www.notion.so/ngrok-855f75ad383e434387ecc4d3faa3a6f6

Installation

bookmark

Commands

Run an instance

1
2
# start in background and forward to https://localhost:3000
nohup ./ngrok http https://localhost:3000 &

Get Tunnels

1
2
3
4
5
curl \
-X GET \
-H "Authorization: Bearer {API_KEY}" \
-H "Ngrok-Version: 2" \
https://api.ngrok.com/tunnels

Response

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
{
  "tunnels": [
    {
      "id": "tn_2NTVGqGpa5w2LExRzILEksu7FOa",
      "public_url": "https://b8ad9cf4eff6.ngrok.paid",
      "started_at": "2023-03-24T19:59:25Z",
      "proto": "https",
      "region": "us",
      "tunnel_session": {
        "id": "ts_2NTVGmVw5yMzr02ZZzlX4VC6b6L",
        "uri": "https://api.ngrok.com/tunnel_sessions/ts_2NTVGmVw5yMzr02ZZzlX4VC6b6L"
      },
      "endpoint": {
        "id": "ep_2NTVGqGpa5w2LExRzILEksu7FOa",
        "uri": "https://api.ngrok.com/endpoints/ep_2NTVGqGpa5w2LExRzILEksu7FOa"
      },
      "forwards_to": "http://localhost:80"
    },
    {
      "id": "tn_2NTVGiqsZQ8EGqJ7HgcysTvGPAN",
      "public_url": "://:0",
      "started_at": "2023-03-24T19:59:24Z",
      "region": "us",
      "tunnel_session": {
        "id": "ts_2NTVGfpxBknN9h3rpLqPiV7NiAw",
        "uri": "https://api.ngrok.com/tunnel_sessions/ts_2NTVGfpxBknN9h3rpLqPiV7NiAw"
      },
      "labels": {
        "baz": "qux",
        "foo": "bar"
      },
      "forwards_to": "http://localhost:80"
    }
  ],
  "uri": "https://api.ngrok.com/tunnels",
  "next_page_uri": null
}

Get Tunnel

1
2
3
4
5
curl \
-X GET \
-H "Authorization: Bearer {API_KEY}" \
-H "Ngrok-Version: 2" \
https://api.ngrok.com/tunnels/tn_2NTVGqGpa5w2LExRzILEksu7FOa

Response

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
{
  "id": "tn_2NTVGqGpa5w2LExRzILEksu7FOa",
  "public_url": "https://b8ad9cf4eff6.ngrok.paid",
  "started_at": "2023-03-24T19:59:25Z",
  "proto": "https",
  "region": "us",
  "tunnel_session": {
    "id": "ts_2NTVGmVw5yMzr02ZZzlX4VC6b6L",
    "uri": "https://api.ngrok.com/tunnel_sessions/ts_2NTVGmVw5yMzr02ZZzlX4VC6b6L"
  },
  "endpoint": {
    "id": "ep_2NTVGqGpa5w2LExRzILEksu7FOa",
    "uri": "https://api.ngrok.com/endpoints/ep_2NTVGqGpa5w2LExRzILEksu7FOa"
  },
  "forwards_to": "http://localhost:80"
}
This post is licensed under CC BY 4.0 by the author.