🟠

Cloudflare Setup Guide

Step-by-step instructions for connecting your domain, configuring DNS, creating an API token, and deploying Cruise Crews via Cloudflare Pages — even if you've never used Cloudflare before.

0 / 8
How Cloudflare fits into your app
User's Phone
DNS Lookup
Cloudflare CDN
& Proxy
Cruise Crews
(CF Pages)

Cloudflare sits between your visitors and your app. It handles HTTPS/SSL automatically, caches assets globally for speed, protects against attacks, and provides the DNS layer where you'll point your QR code URL.

1

Create a Cloudflare Account

Free forever for the features you need. No credit card required.

Go to cloudflare.com and click "Sign Up"

Visit dash.cloudflare.com/sign-up — use the same email you'll use to manage your app.

Verify your email address

Cloudflare will send a verification email. Click the link inside — you won't be able to add a domain without verifying.

Select the Free plan

On the plan selection page choose Free ($0/month). This includes unlimited DNS, SSL, CDN, and Cloudflare Pages — everything you need.

Already have a Cloudflare account? Skip to Step 2. Your existing account works fine — just log in at dash.cloudflare.com.
2

Add Your Domain to Cloudflare

If you already have a domain (e.g. mycruiseapp.com) you'll point it to Cloudflare. Don't have one yet? See the note below.

Don't have a domain yet? You can skip this step and use the free pages.dev subdomain Cloudflare gives you (e.g. cruise-crews.pages.dev) — no domain purchase needed. Jump to Step 7.
Adding an existing domain
In the Cloudflare dashboard, click "Add a domain"

From the home page click the + Add a domain button (top right) or select Websites → Add a site.

Type in your domain name

Enter your root domain exactly as purchased — e.g. cruisecrews.com — without www or https://.

Choose the Free plan and click Continue

Cloudflare will scan your existing DNS records automatically. Review them — they're usually imported correctly.

Note the two Cloudflare nameservers shown

You'll see something like aria.ns.cloudflare.com and bob.ns.cloudflare.com. Copy these — you'll need them in Step 3.

Your Cloudflare nameservers

Save your nameservers here so you don't lose them:

3

Update Nameservers at Your Registrar

Tell the company you bought your domain from to route DNS through Cloudflare.

Find your registrar's nameserver settings
Log in to your domain registrar

Common registrars: GoDaddy, Namecheap, Google Domains (now Squarespace), Porkbun, Cloudflare Registrar. Go to their DNS or Domain Management section.

Find "Nameservers" or "Custom DNS"

Look for a section called Nameservers, Custom Nameservers, or DNS Servers. Select "Custom" or "Use custom nameservers".

Replace existing nameservers with Cloudflare's

Delete any existing nameservers and enter the two Cloudflare nameservers from Step 2. Save the changes.

Wait for propagation (up to 24 hours)

Usually takes 5–30 minutes. Cloudflare will email you once it detects the change. You can check at dnschecker.org.

Be patient. DNS propagation can take up to 48 hours in rare cases. Your site may be unreachable during this window — plan accordingly before sharing QR codes.
Registrar-specific paths
GoDaddy

My Products → DNS → Manage DNS → Nameservers → Change → I'll use my own nameservers → enter both → Save

Namecheap

Domain List → Manage → Nameservers dropdown → Custom DNS → enter both → green tick to save

Google Domains / Squarespace

Manage → DNS → Name servers → Use custom name servers → enter both → Save

Porkbun

Domain → Details → Authoritative Nameservers → edit → paste both NS values → Update

4

Configure DNS Records

Point your domain to Cloudflare Pages. These are the exact records you need.

Required DNS records for Cloudflare Pages

In the Cloudflare dashboard → your domain → DNS → Records → Add record

dash.cloudflare.com → DNS → Records
CNAME @ (root) your-project.pages.dev Proxied
CNAME www your-project.pages.dev Proxied
Replace your-project.pages.dev with the actual .pages.dev URL Cloudflare Pages gives you in Step 7. You can come back and update this record once you have it.
Go to DNS → Records in your Cloudflare dashboard

Select your domain from the home page, then click DNS in the left sidebar → Records.

Add CNAME record for root domain (@)

Type: CNAME · Name: @ · Target: your-project.pages.dev · Proxy: Proxied (orange cloud ON)

Add CNAME record for www subdomain

Type: CNAME · Name: www · Target: your-project.pages.dev · Proxy: Proxied (orange cloud ON)

Make sure "Proxied" is ON (orange cloud)

The orange cloud icon means Cloudflare is proxying the traffic — this enables SSL, caching, and protection. Do NOT set to DNS Only (grey cloud) for Pages.

5

Create a Cloudflare API Token

An API token lets external tools (CI/CD, deploy scripts) interact with Cloudflare securely without exposing your password.

Common mistake: Using your Global API Key instead of an API Token. The Global API Key gives full account access — very dangerous. Always use a scoped API Token instead.
Creating a scoped API Token (recommended)
Go to Profile → API Tokens

Click your avatar (top-right) → My ProfileAPI Tokens tab → Create Token.

Use the "Edit Cloudflare Workers" template — or create custom

For Cloudflare Pages deployments, click Use template next to "Edit Cloudflare Workers" — it includes the Pages permissions.

Set the correct permissions

Minimum permissions needed:

Required Token Permissions
Account  · Cloudflare Pages       · Edit
Account  · Account Settings       · Read
Zone     · DNS                    · Edit   (only if managing DNS via API)
Zone     · Zone                   · Read
Set Account Resources → your account

Under Account Resources, select the specific account the token should apply to (not "All accounts" unless necessary).

Click Continue to Summary → Create Token

Review the permissions summary and click Create Token.

⚠️ Copy the token NOW — it shows only once!

Cloudflare shows the token value only once. Copy it immediately and save it in a password manager or your deployment environment's secret store.

Never commit your API token to Git or paste it in a public file. Store it as an environment variable or secret in your CI/CD platform.
Securely store your token

Save your token reference here (this field is local — never sent anywhere):

Just a label to help you remember which token this is.
Found in the Cloudflare dashboard → right sidebar → "Account ID".
Where to find your Account ID
# In the Cloudflare dashboard URL:
https://dash.cloudflare.com/YOUR_ACCOUNT_ID/

# Or: Right sidebar of any domain page:
APIAccount ID  (click to copy)
Test your API token

Run this in your terminal to verify the token works:

Terminal — Token Verification
curl -X GET "https://api.cloudflare.com/client/v4/user/tokens/verify" \
     -H "Authorization: Bearer YOUR_API_TOKEN_HERE" \
     -H "Content-Type: application/json"

# Expected response if valid:
{
  "result": { "id": "...", "status": "active" },
  "success": true
}
6

Configure SSL / HTTPS

Cruise Crews must be served over HTTPS — service workers and PWA install prompts won't work over HTTP.

SSL settings checklist

SSL/TLS Encryption Mode → Full (Strict)

Dashboard → your domain → SSL/TLS → Overview → set to Full (strict)

Always Use HTTPS

SSL/TLS → Edge Certificates → "Always Use HTTPS" → ON

Automatic HTTPS Rewrites

SSL/TLS → Edge Certificates → "Automatic HTTPS Rewrites" → ON

Minimum TLS Version → TLS 1.2

SSL/TLS → Edge Certificates → "Minimum TLS Version" → TLS 1.2

Cloudflare Pages automatically provisions a free TLS certificate for your .pages.dev domain and any custom domain you add to the project. No manual certificate setup needed.
Common SSL errors & fixes
Error 525: SSL Handshake Failed

Cause: SSL mode set to "Full (Strict)" but your origin has no valid cert. Fix: Switch SSL mode to Full (not strict) or make sure your origin cert is valid. For Pages this shouldn't happen — use Full (Strict).

Error 526: Invalid SSL Certificate

Cause: Cloudflare can't verify the cert on your origin. Fix: Use Cloudflare Origin CA certificate on your origin, or switch to Full (not strict).

Mixed Content Warnings

Cause: Page loaded over HTTPS but some resources use HTTP. Fix: Enable Automatic HTTPS Rewrites in SSL/TLS → Edge Certificates, or fix the HTTP URLs in your HTML.

Service Worker won't register

Cause: Page not served over HTTPS (service workers require secure context). Fix: Ensure the domain is proxied through Cloudflare with "Always Use HTTPS" ON.

7

Deploy to Cloudflare Pages

Host Cruise Crews on Cloudflare's global CDN — free, with 500 builds/month on the free plan.

Option A — Connect a GitHub / GitLab repo (recommended)
Go to Workers & Pages → Create → Pages

In the Cloudflare dashboard, click Workers & Pages (left sidebar) → CreatePages tab → Connect to Git.

Authorize Cloudflare and select your repo

Click Connect GitHub (or GitLab), authorize the integration, then select the repository containing your Cruise Crews files.

Set build configuration

For a plain HTML/CSS/JS project (no build step):

Build Settings
Framework preset:  None
Build command:     (leave empty)
Build output dir:  /    ← root of repo
Root directory:    (leave empty)
Click "Save and Deploy"

Cloudflare will deploy your site in ~30 seconds. You'll get a URL like cruise-crews-abc.pages.dev.

Add your custom domain (optional)

In your Pages project → Custom domainsSet up a custom domain → enter cruisecrews.com → Cloudflare auto-creates the CNAME record.

Option B — Direct upload (no Git needed)
Go to Workers & Pages → Create → Pages → Upload assets

Choose Upload assets instead of "Connect to Git". Give your project a name (e.g. cruise-crews).

Drag and drop your project folder

Drag the entire project folder (containing index.html, manifest.json, service-worker.js, icons/ etc.) onto the upload area.

Click Deploy site

Your site goes live in seconds at your-name.pages.dev. Update your QR code URL on qr.html with this new URL.

Direct upload is great for quick testing. For ongoing updates, Option A (Git) is better — every push to your repo auto-deploys a new version.
Option C — Deploy via API / CLI (Wrangler)
Terminal — Wrangler CLI Deploy
# 1. Install Wrangler
npm install -g wrangler

# 2. Authenticate with your API token
wrangler login
# OR use token directly:
export CLOUDFLARE_API_TOKEN=your_token_here

# 3. Deploy your project folder
wrangler pages deploy ./ --project-name=cruise-crews

# Expected output:
✨ Success! Deployed to https://cruise-crews.pages.dev
When using CLOUDFLARE_API_TOKEN as an env variable, make sure the token has Cloudflare Pages: Edit permission (Step 5).
8

Verify & Test Everything

Run through this checklist before sharing your QR code with the crew.

Pre-launch checklist
Site loads at your domain over HTTPS

Open https://yourdomain.com — confirm the padlock 🔒 is green and no mixed-content warnings appear.

Service worker registers successfully

Open DevTools → Application → Service Workers — confirm the SW shows status activated and running.

PWA install prompt appears (Android/Chrome)

Visit on Android Chrome — the "Add to Home Screen" banner or install icon in the address bar should appear within a few seconds.

iOS Safari "Add to Home Screen" works

Open in Safari on iPhone → Share → Add to Home Screen → confirm it installs and launches full-screen.

Offline mode works

In DevTools → Network → set to Offline → reload the page — it should load from cache (not show a Chrome dino).

QR code scans correctly

Go to qr.html → update the URL to your live domain → scan with a phone camera — confirm it opens the app.

Run Lighthouse PWA audit

DevTools → Lighthouse → select Progressive Web App → Generate report. Aim for a green PWA badge ✅.

www redirects to root (or vice versa)

Check that https://www.yourdomain.com redirects to https://yourdomain.com (or stays on www — just be consistent).

Useful debugging tools
Cloudflare DNS Checker

dnschecker.org — check DNS propagation from 20+ global locations

SSL Labs Server Test

ssllabs.com/ssltest — verify your SSL certificate grade (aim for A or A+)

PWA Builder

pwabuilder.com — validates your PWA manifest, SW, and generates app store packages

Cloudflare API Token Test
cURL
curl https://api.cloudflare.com/client/v4/user/tokens/verify \
  -H "Authorization: Bearer YOUR_TOKEN"
You're live! Once all 8 steps are checked, go to qr.html, update the URL to your live domain, download the QR code and share it with your crew before boarding. 🚢
Generate QR Code
Copied!