Skip to main content
Production APIs require a secure (HTTPS) origin — requests from 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


Step 2 — Get your Auth Token

  1. Go to ngrok.com and sign up (free)
  2. After login, go to Dashboard → Your Authtoken
  3. Copy the token — it looks like 2abc123XYZ_abcdefghijklmnop

Step 3 — Add the token (one-time only)

You only need to do this once per machine.

Step 4 — Start your app, then run ngrok

Start your local server first, then in a second terminal:
Replace <YOUR_APP_PORT> with the port your app runs on (e.g. 3000, 8000, 8080). ngrok will show output like:
Open that https:// URL in any browser, on any device — it works and satisfies CORS requirements for production APIs.

Stop ngrok

Press Ctrl+C in the ngrok terminal.