How to expose a Devkinsta site with ngrok

I had a need to expose one of my DevKinsta vhosts to the public briefly using ngrok. It took me long enough to figure out, I thought I’d share the steps in case they might be useful to someone else.

  1. With your docker/DevKinsta environment running, run the following command in a fresh terminal:
docker pull ngrok/ngrok
  1. When that finishes, run the following command:
docker run --net=host -it -e NGROK_AUTHTOKEN=<your_auth_token> ngrok/ngrok:latest http --host-header=rewrite yoursite.local:443

Once ngrok launches, you should be able to browser your local site from the public URL provided.

You’ll have to sign up for a free ngrok account to get an auth token. The trick that took me so long to figure out was to specify the https port (443) instead of 80, which is spelled out in all of the examples. Your local site of course will need to be available on https, but it does work. Anything else gives various cryptic errors that are simply not helpful in tracking down a solution.

Hi @voyager131 ! Welcome back to the Kinsta Community.

Thank you for providing this information! That’s extremely helpful.

If there’s anything we can do to help as well, please let us know.

Glad to give back a little. One more note on my proposed solution… Every time you issue docker run… it creates a new instance. So after a while you’ll have a whole lot of stale instances hanging around. They’re easy enough to clean up but you’ll want to do that periodically.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.