Skip to content

Commit b712078

Browse files
CF external mode Warning
1 parent cadf345 commit b712078

File tree

2 files changed

+46
-40
lines changed

2 files changed

+46
-40
lines changed

README.MD

Lines changed: 46 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,7 @@ DockFlare simplifies Cloudflare Tunnel and Zero Trust Access policy management b
124124
# Name for the Cloudflare Tunnel managed by DockFlare
125125
# (Required if NOT using an external cloudflared instance)
126126
TUNNEL_NAME=DockFlare-Tunnel
127-
128-
# --- External Cloudflared Mode (Advanced) ---
129-
# USE_EXTERNAL_CLOUDFLARED=false
130-
# EXTERNAL_TUNNEL_ID=your_existing_external_tunnel_id
131-
127+
132128
# === DOCKFLARE BEHAVIOR & CUSTOMIZATION ===
133129
LABEL_PREFIX=cloudflare.tunnel
134130
GRACE_PERIOD_SECONDS=28800
@@ -286,29 +282,57 @@ This creates an Access Application named "DockFlare-secure-app.example.com" requ
286282
<details>
287283
<summary>🔄 External `cloudflared` Mode & Switching</summary>
288284

289-
IMPORTANT: Currently this Mode is under heavy development and not recommended.
290-
DockFlare can manage DNS and Access Applications for an existing `cloudflared` tunnel that you manage separately.
285+
> [!CAUTION]
286+
> **ADVANCED USERS ONLY - HIGH POTENTIAL FOR MISCONFIGURATION**
287+
>
288+
> External `cloudflared` mode is powerful but requires a **deep understanding of Docker networking and Cloudflare Tunnels.** Misconfiguration can easily lead to services being unreachable or DockFlare being unable to manage resources correctly.
289+
>
290+
> **Proceed with extreme caution and only if you are comfortable managing `cloudflared` and Docker network configurations independently.** This mode is **not recommended** for users new to Docker or Cloudflare Tunnels.
291+
292+
DockFlare can integrate with an existing `cloudflared` tunnel that you manage completely separately (i.e., not started or configured by DockFlare). In this mode, DockFlare focuses on DNS and Cloudflare Access Application management for that tunnel.
293+
294+
**Critical Prerequisite: Docker Network Configuration**
295+
296+
* For DockFlare to successfully interact with your services when using an external `cloudflared` tunnel, **all relevant containers (DockFlare itself, your target application containers, and potentially your externally managed `cloudflared` agent if it needs to resolve services by Docker DNS) must share a common Docker network and be able to communicate.**
297+
* You are responsible for ensuring that the "Service Address" you define in DockFlare (via labels or UI) is resolvable and reachable from your *externally managed* `cloudflared` agent.
298+
* Incorrect network setup is the most common source of issues in this mode.
299+
300+
**To Use External Mode:**
291301

292-
**To use External Mode:**
293-
1. Set `USE_EXTERNAL_CLOUDFLARED=true` in your `.env`.
294-
2. Set `EXTERNAL_TUNNEL_ID` to your existing tunnel's ID.
295-
<details>
296-
<summary>Find Your Tunnel ID</summary>
297-
298-
1. Log in to [Cloudflare Dashboard](https://dash.cloudflare.com).
299-
2. Navigate to **Zero Trust** -> **Access** -> **Tunnels**.
300-
3. Select your tunnel. The ID is in the URL and on the overview page.
301-
</details>
302+
1. Set `USE_EXTERNAL_CLOUDFLARED=true` in your `.env` file.
303+
2. Set `EXTERNAL_TUNNEL_ID` in your `.env` file to your existing tunnel's UUID.
304+
<details>
305+
<summary>How to Find Your Existing Tunnel ID</summary>
306+
307+
1. Log in to the [Cloudflare Dashboard](https://dash.cloudflare.com).
308+
2. Navigate to **Zero Trust** -> **Access** -> **Tunnels**.
309+
3. Select your desired pre-existing tunnel.
310+
4. The Tunnel ID (a UUID) is displayed on the tunnel's overview page and is also present in the URL.
311+
</details>
302312

303313
**DockFlare's Behavior in External Mode:**
304-
- DockFlare will **not** start or manage a `cloudflared` agent container.
305-
- It **will** create/delete CNAME DNS records pointing to your `EXTERNAL_TUNNEL_ID`.
306-
- It **will** create/update/delete Cloudflare Access Applications based on labels or UI interactions for services it manages.
307-
- It will **not** modify the tunnel's ingress rules directly (as this is typically managed by the external `cloudflared` agent's configuration file).
314+
315+
* ✅ **WILL** create/update/delete CNAME DNS records in your configured Cloudflare zones, pointing to your `EXTERNAL_TUNNEL_ID`.
316+
* ✅ **WILL** create/update/delete Cloudflare Access Applications based on Docker labels or UI interactions for services it manages.
317+
* ❌ **WILL NOT** start, stop, or manage a `cloudflared` agent Docker container. You are fully responsible for the lifecycle and configuration of your `cloudflared` agent.
318+
* ❌ **WILL NOT** modify the tunnel's ingress rules via the Cloudflare API. Ingress routing (which public hostnames/paths map to which internal services) must be configured directly in your externally managed `cloudflared` agent's configuration file (e.g., `config.yml`). DockFlare assumes your external `cloudflared` agent is already correctly routing traffic for the hostnames it manages DNS for.
308319

309320
> [!WARNING]
310321
> **Authoritative DNS Management in External Mode:**
311-
> When `USE_EXTERNAL_CLOUDFLARED=true`, DockFlare assumes it has authoritative control over CNAME records in the specified zones that point to the `EXTERNAL_TUNNEL_ID`. It may remove CNAMEs it doesn't recognize as actively managed by its rules if they point to the same tunnel ID. Ensure no other systems are creating CNAMEs for this specific external tunnel in the zones DockFlare monitors.
322+
> When `USE_EXTERNAL_CLOUDFLARED=true`, DockFlare assumes it has **authoritative control** over CNAME DNS records in the specified Cloudflare zones that point to the `EXTERNAL_TUNNEL_ID`.
323+
>
324+
> * It **may remove CNAME records** it doesn't recognize as actively managed by its current rules if those CNAMEs point to the same `EXTERNAL_TUNNEL_ID` within the monitored zones.
325+
> * Ensure no other systems or manual configurations are creating CNAMEs for this specific external tunnel in the zones DockFlare monitors, as they might be overwritten or deleted.
326+
327+
**Before Enabling External Mode, Ensure You Can Answer "Yes" To:**
328+
329+
1. Do I have a `cloudflared` tunnel already running and configured independently of DockFlare?
330+
2. Does my external `cloudflared` agent's configuration file (`config.yml`) correctly define ingress rules for the services I want DockFlare to manage DNS/Access for?
331+
3. Are DockFlare, my target application containers, and my external `cloudflared` agent (if resolving services by Docker DNS) all on a shared Docker network that allows them to communicate as needed?
332+
4. Am I comfortable troubleshooting Docker networking issues independently?
333+
5. Do I understand that DockFlare will manage DNS records pointing to my external tunnel ID and may remove conflicting ones?
334+
335+
If you cannot confidently answer "yes" to all these questions, using DockFlare's default managed `cloudflared` mode is strongly recommended.
312336

313337
**Switching Modes (e.g., Internal to External):**
314338
This requires careful steps to avoid conflicts.

env.example

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -42,24 +42,6 @@ CF_ZONE_ID=your_default_cloudflare_zone_id_here
4242
# Example: dockflare-myhome
4343
TUNNEL_NAME=dockflared-tunnel
4444

45-
# --- External Cloudflared Mode (Advanced) ---
46-
# Set USE_EXTERNAL_CLOUDFLARED to 'true' if you want DockFlare to manage DNS/Access
47-
# for an existing tunnel managed by a separate cloudflared agent, instead of running its own.
48-
#
49-
# WARNING: If USE_EXTERNAL_CLOUDFLARED is 'false' (default), DockFlare v1.7+ takes an
50-
# authoritative stance on its managed tunnel's ingress configuration. It will remove
51-
# non-wildcard, non-catch-all ingress rules found on Cloudflare for that tunnel if
52-
# they are not defined in DockFlare's state (from Docker labels or Manual UI entries).
53-
# This ensures consistency. True external wildcards and the catch-all are preserved.
54-
#
55-
# USE_EXTERNAL_CLOUDFLARED=false
56-
57-
# External Tunnel ID (Required ONLY if USE_EXTERNAL_CLOUDFLARED=true)
58-
# Please note currently under review not recommended.
59-
# The ID of your existing, externally managed Cloudflare Tunnel.
60-
# Find in Cloudflare Dashboard: Zero Trust -> Access -> Tunnels -> (select your tunnel)
61-
# EXTERNAL_TUNNEL_ID=your_existing_external_tunnel_id
62-
6345
# === DOCKFLARE BEHAVIOR & CUSTOMIZATION ===
6446

6547
# Docker Label Prefix

0 commit comments

Comments
 (0)