I’m working with web hooks and OAuth from Slack and other services so I’ve been using ngrok to get my environment setup correctly for that testing. I wanted to quickly share my config because I ran into a limit with the current ngrok docs on CORS.
When I tried to run two different clients at the same time ngrok http 8910
and ngrok http 8911
I got an error from ngrok about my free account not supporting multiple clients running at once. However you’re able to run two tunnels with a single client and free account but you need to do it differently. And I actually like the different setup anyway.
Instructions
Find your ngrok.yml
file by running this config check command:
ngrok config check
Open the ngrok.yml
file in the location returned and add this:
tunnels:
api:
proto: http
addr: 8911
web:
proto: http
addr: 8910
Now you can start ngrok tunnels for both the web and api at once by running
ngrok start web api
Since I leave the ngrok terminal running off on its own, when I want to grab the URLs I use this:
curl -s http://localhost:4040/api/tunnels | jq '.tunnels[] | "\(.config.addr) --> \(.public_url)"'
"http://localhost:8910 --> https://b-l-a-a-a-h.ngrok.io"
"http://localhost:8911 --> https://b-l-a-a-r-g.ngrok.io"
Thanks!