http://localhost will fail CORS preflight checks. ngrok solves this by tunneling your local server through a public HTTPS URL in seconds.
Step 1 — Install ngrok
- macOS
- Windows (Chocolatey)
- Windows (Scoop)
- Windows (manual)
Step 2 — Get your Auth Token
- Go to ngrok.com and sign up (free)
- After login, go to Dashboard → Your Authtoken
- Copy the token — it looks like
2abc123XYZ_abcdefghijklmnop
Step 3 — Add the token (one-time only)
Step 4 — Start your app, then run ngrok
Start your local server first, then in a second terminal:<YOUR_APP_PORT> with the port your app runs on (e.g. 3000, 8000, 8080).
ngrok will show output like:
https:// URL in any browser, on any device — it works and satisfies CORS requirements for production APIs.
Stop ngrok
PressCtrl+C in the ngrok terminal.
