Documentation/Cloudflare Integration

Cloudflare Integration

Learn how to connect your Cloudflare account to RedirectFlow for lightning-fast global redirects powered by Cloudflare Workers.

Why Cloudflare?

Performance Benefits

  • Sub-10ms response times globally
  • 200+ edge locations worldwide
  • 99.99% uptime SLA

Security Features

  • DDoS protection included
  • SSL/TLS encryption
  • Bot protection

Free Tier Available: Cloudflare offers generous free plans that work perfectly with RedirectFlow.

Prerequisites

1

Cloudflare Account

Create a free account at cloudflare.com if you don't have one already.

2

Domain on Cloudflare

Your domain must be managed by Cloudflare (DNS can be proxied or DNS-only).See instructions below.

3

API Token

You'll need a Cloudflare API token with Workers permissions. We'll create this together.

1

Add Your Domain to Cloudflare

If your domain isn't already on Cloudflare, follow these steps to add it:

Option A: Transfer DNS to Cloudflare (Recommended)

  1. 1Log into your Cloudflare dashboard and click "Add a Site"
  2. 2Enter your domain name and click "Add Site"
  3. 3Choose a plan (Free plan works fine for redirects)
  4. 4Review your DNS records and click "Continue"
  5. 5Update your domain's nameservers to the ones provided by Cloudflare

Option B: CNAME Setup (Partial)

If you can't change nameservers, you can use CNAME setup for subdomains:

  1. 1. Add your domain to Cloudflare as above
  2. 2. In your current DNS provider, create a CNAME record pointing your subdomain to Cloudflare
  3. 3. Enable "Orange Cloud" (proxied) in Cloudflare DNS settings

Important: Propagation can take up to 24 hours. You'll see an "Active" status in Cloudflare when complete.

2

Create API Token

Create a Cloudflare API token with the minimum required permissions for RedirectFlow:

Step-by-Step Token Creation

  1. 1Go to Cloudflare API Tokens
  2. 2Click "Create Token" and select "Custom token"
  3. 3Configure the token with these settings:

Required Token Permissions

Token name:RedirectFlow API
Permissions:Zone:Zone Settings:Edit
Zone:Zone:Read
Zone:DNS:Edit
User:User Details:Read
Account:Cloudflare Workers:Edit
Zone Resources:Include - Specific zone - your-domain.com
Account Resources:Include - All accounts

After Creating the Token

  1. 4Copy the token immediately (you won't see it again)
  2. 5Test the token using the provided curl command
  3. 6Keep it secure - treat it like a password

Security: Never share your API token or commit it to version control. Store it securely.

3

Configure RedirectFlow

Now connect your Cloudflare account to RedirectFlow:

In RedirectFlow Dashboard

  1. 1Go to Settings → Cloudflare Integration
  2. 2Paste your API token in the "API Token" field
  3. 3Select your Zone ID from the dropdown (auto-populated after token verification)
  4. 4Click "Test Connection" to verify everything works
  5. 5Save your settings

✅ Connection Success

You'll see your account email, zone name, and a green "Connected" status when successful.

❌ Connection Failed

Check your token permissions and zone selection. See troubleshooting below.

4

Deploy Worker Script

RedirectFlow automatically creates and manages a Cloudflare Worker for your redirects:

Automatic Setup

When you create your first redirect, RedirectFlow will automatically:

  • Create a Worker script named "redirectflow-worker"
  • Set up routes to intercept matching requests
  • Deploy the redirect logic to Cloudflare's edge
  • Update the script whenever you modify redirects

Manual Setup (Advanced)

If you prefer manual control, you can deploy the worker yourself:

  1. 1. Go to Settings → Cloudflare Integration
  2. 2. Click "Setup Worker" button
  3. 3. Review the generated worker code
  4. 4. Click "Deploy Worker" to push to Cloudflare

Success! Your redirects will be active within 30 seconds across Cloudflare's global network.

Troubleshooting

❌ "Invalid API token"

Common causes and solutions:

  • • Double-check the token was copied completely (no extra spaces)
  • • Verify the token has all required permissions
  • • Make sure the token isn't expired
  • • Check that you selected the correct zone in permissions

⚠️ "Zone not found"

Your domain isn't properly set up on Cloudflare:

  • • Ensure your domain is added to Cloudflare
  • • Check that DNS is active (not just DNS-only)
  • • Wait for DNS propagation (up to 24 hours)
  • • Verify the domain status is "Active" in Cloudflare dashboard

❌ "Worker deployment failed"

Issues with Worker deployment:

  • • Check that your API token has Workers:Edit permission
  • • Verify you're not hitting Cloudflare's Worker limits
  • • Try deploying manually from the Cloudflare dashboard
  • • Contact support if the issue persists