Skip to content

Instantly share code, notes, and snippets.

@vyspiansky
Last active March 19, 2025 07:37
Show Gist options
  • Save vyspiansky/0d727bef9d0e78c5118d325954089135 to your computer and use it in GitHub Desktop.
Save vyspiansky/0d727bef9d0e78c5118d325954089135 to your computer and use it in GitHub Desktop.
ngrok: create a tunnel from the public internet to your local machine

ngrok notes

ngrok creates a tunnel from the public internet to your local machine.

Install

Sign up for an ngrok account https://dashboard.ngrok.com/

brew install ngrok/ngrok/ngrok
ngrok config add-authtoken <YOUR_TOKEN>

Run

ngrok http http://localhost:8080

HTTP + host header

ngrok http --host-header="local.site" http://local.site

HTTPS + host header

ngrok http --host-header="local.site" https://local.site

Some applications get confused when they see a different host header than expected.

To resolve this, you can instruct ngrok to rewrite the Host header to “localhost” by using the --host-header flag:

ngrok http [port] --host-header="localhost:[port]"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment