Exposing Secure Tunnels

This guide will walk you through how to use secure tunnels to expose your local development services to the internet. This is useful for sharing your work with clients, team members, or testing on mobile devices.

Default configuration

By default, Spin Pro supports using Ngrok's Free Plan to expose your services to the internet. You'll need to create an account with Ngrok and install it to your machine following their instructions.

Install Ngrok

Using Ngrok

Once Ngrok is installed and authenticated, you can start a very basic tunnel by running the following command in your terminal:

Start a tunnel

ngrok http https://localhost

You will need to keep the terminal window open to keep the tunnel active, but you can find your public URL in the terminal output. This URL can be shared with anyone to access your local services.

If you'd like to learn about more advanced features of Ngrok, check out their docs.

Ngrok connected

Customizing the tunnel

By default, Spin Pro supports any *.ngrok-free.app domain that connects. If you need to change this, open up your docker-compose.dev.yml file and update the labels for the php service.

docker-compose.dev.yml

services:
  php:
    labels:
      - "traefik.http.routers.laravel-web.rule=Host(`laravel.dev.test`) || HostRegexp(`^.+\\.ngrok-free\\.app$$`)"

You can change the ^.+\\.ngrok-free\\.app$$ expression to match any domain you need to support.