The Forge tunnel uses ngrok to connect the Forge backend to your local development server. However, ngrok only allows sessions of up to two hours and rate-limits traffic for anonymous users. When you reach one of these limits, you often have to restart the tunnel.
It turns out that you can remove the session limit and increase the rate limits by signing up for a free ngrok account (or using a paid account) and modifying a file in the tunnel package.
Note about Docker❗
The instructions below only work if you are using the tunnel without Docker. The hack should also work for the dockerized tunnel, but you would have to create a custom image based on atlassian/forge-tunnel
and force the CLI to use the custom image instead of the latest version from the Docker Hub registry.
If you are using macOS or Linux, run which forge
to find the install location of the CLI. For the output <path>/bin/forge
, the file you need to modify is <path>/lib/node_modules/@forge/sandbox-tunnel/node_modules/@forge/tunnel/config/ngrok.yml
. Add the line authtoken: <token>
, replacing <token>
with your ngrok Authtoken.
You can verify that the hack is working by opening http://localhost:4040 when the tunnel is running. There should be no warning message about the session limit and your Authtoken should be shown on the status page.