This post will guide you through creating a Cloudflare Tunnel for a local Lando service container.
Create Tunnel
- Create a new directory
.cloudflare
- Authorize Argo Tunnel for Domain
- Select the Domain
- A file
cert.pem
will be starting to download
- Store
cert.pem
in.cloudflare/cert.pm
- Run
cloudflared tunnel --config=.cloudflare/config.yml --origincert=./.cloudflare/cert.pem create "Test"
- Set tunnel id to
tunnel
value in.cloudflare/config.yml
- Create DNS CNAME Entry with
<TUNNEL ID>.cfargotunnel.com
- Start Tunnel via the script below
Start Tunnel
In my case I want to expose the appserver_nginx
Lando service to the tunnel.
cloudflared tunnel \
--config=.cloudflare/config.yml \
--origincert=./.cloudflare/cert.pem \
run \
--url=$(lando info --filter "service=appserver_nginx" --format json | jq '.[0].urls[1]' | sed 's/\"//g')
You can debug all requests using the --loglevel debug
flag.