Rupin Raveendra Nath

Rupin Raveendra Nath

// Software Engineer in Test

Expose localhost with cloudflared

// Published On: Oct 13, 2026

Need to show a local dev server to someone, or test a webhook, without deploying? Cloudflare Tunnel gives you a public URL in one command, with no account or config needed.

brew install cloudflared
cloudflared tunnel --url http://localhost:4321

It prints a random https://<words>.trycloudflare.com URL that forwards to your local port. Stop it with Ctrl+C and the URL dies with it.

With Docker Compose

To run the tunnel next to a containerized service, add cloudflared as another service and point it at the service name instead of localhost:

services:
  # Your local app/service you want to expose
  web:
    image: nginx:latest
    restart: unless-stopped
    ports:
      - "8080:80"

  # Cloudflare Quick Tunnel
  tunnel:
    image: cloudflare/cloudflared:latest
    restart: unless-stopped
    command: tunnel --no-autoupdate --url http://web:80
    depends_on:
      - web

Run docker compose up -d, then find the public URL in the tunnel logs:

docker compose logs tunnel | grep trycloudflare

Inside the Compose network, web:80 is the container port, not the 8080 published on your host.

Quick tunnels are for testing only: the URL changes every run and there is no uptime guarantee.