Raised: $0
0% of monthly goal Help us cross the finish line!
Goal: $12,000
Raised: $0 Goal: $12,000
0% of monthly goal Help us cross the finish line!
Sponsor DDEV

ddev-share-cf

Share your DDEV sites publicly using Cloudflare Tunnel (free alternative to ddev share)

version license DDEV registry](https://github.com/ddev/ddev-addon-registry)

What is this?

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.

Features

Requirements

Installation

1. Install cloudflared

First, 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.

2. Install the DDEV addon

ddev add-on get davo20019/ddev-share-cf

Usage

From your DDEV project directory, simply run:

ddev share-cf

This will:

  1. Check if cloudflared is installed (shows installation instructions if not)
  2. Start a Cloudflare Tunnel
  3. Display a public URL you can share (like https://randomly-generated.trycloudflare.com)

Press Ctrl+C to stop the tunnel when you’re done.

How It Works

When you run ddev share-cf, the addon:

  1. Verifies cloudflared is installed on your host machine
  2. Creates a temporary Cloudflare Tunnel pointing to your DDEV site
  3. Routes public traffic through Cloudflare’s network to your local DDEV site
  4. No Cloudflare account or configuration required

The tunnel URL changes each time you run the command (similar to ddev share).

Comparison with 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

Use Cases

Perfect for:

Troubleshooting

cloudflared not found

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.

Command not found after installation

Make sure the addon is properly installed:

ddev add-on get davo20019/ddev-share-cf

Permission denied error

The script should be executable, but if you encounter issues:

chmod +x .ddev/commands/host/share-cf

Project not running

Make sure your DDEV project is running before starting the tunnel:

ddev start
ddev share-cf

Drupal Multisite Configuration

When using with Drupal multisite, you need to map the Cloudflare tunnel URL to your subsite in sites/sites.php:

  1. Run ddev share-cf and note the generated URL (e.g., https://random-name.trycloudflare.com)
  2. Add the mapping to your 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
  1. The tunnel will now correctly route to your subsite

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.

Contributing

Contributions, issues, and feature requests are welcome!

License

Apache License 2.0 - see LICENSE file for details.

Maintainer

David Loor

Acknowledgments