Share your DDEV sites publicly using Cloudflare Tunnel (free alternative to ddev share
)
](https://github.com/ddev/ddev-addon-registry)
This DDEV addon provides a simple command to share your local DDEV sites publicly using Cloudflare Tunnel. It works similarly to ddev share
(which uses ngrok) but with Cloudflare’s free tunnel service.
ddev share-cf
and get a public URLcloudflared
binary installed on your host machineFirst, install cloudflared
on your host machine:
macOS (Homebrew):
brew install cloudflared
Debian/Ubuntu:
curl -L https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb -o cloudflared.deb
sudo dpkg -i cloudflared.deb
RHEL/CentOS/Fedora:
curl -L https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.rpm -o cloudflared.rpm
sudo rpm -i cloudflared.rpm
Windows:
winget install --id Cloudflare.cloudflared
For other installation methods, see the Cloudflare documentation.
ddev add-on get davo20019/ddev-share-cf
From your DDEV project directory, simply run:
ddev share-cf
This will:
cloudflared
is installed (shows installation instructions if not)https://randomly-generated.trycloudflare.com
)Press Ctrl+C to stop the tunnel when you’re done.
When you run ddev share-cf
, the addon:
cloudflared
is installed on your host machineThe tunnel URL changes each time you run the command (similar to ddev share
).
ddev share
Feature | ddev share (ngrok) |
ddev share-cf (Cloudflare) |
---|---|---|
Free tier | 40 connections/min | Unlimited |
Speed | Good | Excellent (Cloudflare CDN) |
Account required | Yes | No |
Setup | Configure token | Zero config |
URL persistence | Changes each time | Changes each time |
Perfect for:
If you get an error that cloudflared
is not installed, the command will automatically detect your operating system and show you the appropriate installation instructions.
You can also manually install cloudflared by following the instructions in the Installation section above.
Make sure the addon is properly installed:
ddev add-on get davo20019/ddev-share-cf
The script should be executable, but if you encounter issues:
chmod +x .ddev/commands/host/share-cf
Make sure your DDEV project is running before starting the tunnel:
ddev start
ddev share-cf
When using with Drupal multisite, you need to map the Cloudflare tunnel URL to your subsite in sites/sites.php
:
ddev share-cf
and note the generated URL (e.g., https://random-name.trycloudflare.com
)web/sites/sites.php
:<?php
// Map the Cloudflare tunnel URL to your subsite
$sites['random-name.trycloudflare.com'] = 'stage'; // Replace 'stage' with your subsite directory name
Note: The tunnel URL changes each time you run the command, so you’ll need to update sites.php
with the new URL for each session.
Contributions, issues, and feature requests are welcome!
Apache License 2.0 - see LICENSE file for details.
David Loor
ddev share
command