Appearance
Deployment Guide
Blocked: Domain Not on CloudflareStep-by-step guide to deploy the Cloudflare Worker and load content variants once the domain is on Cloudflare.
Prerequisites
- [ ]
andersonhemmat.comadded to Cloudflare (nameserver change or DNS proxy) - [ ] Orange-cloud proxy enabled on the A record for
andersonhemmat.com - [ ] Wrangler CLI installed:
npm install -g wrangler - [ ] Wrangler authenticated:
wrangler login
Deployment Flow
flowchart TD
A[DNS: Add domain to Cloudflare] --> B[Enable orange-cloud proxy on A record]
B --> C[Verify CF headers appear: cf-ray, cf-cache-status]
C --> D[Create KV namespace AI_VARIANTS]
D --> E[Create KV namespace AI_VISITS_LOG]
E --> F[Load variant content into AI_VARIANTS KV]
F --> G[Update wrangler.toml with KV IDs]
G --> H[Deploy worker: wrangler deploy]
H --> I[Verify route is active in CF dashboard]
I --> J[Test with GPTBot UA]
J --> K[Monitor AI_VISITS_LOG]Step 1: Verify Cloudflare Proxy is Active
After DNS change, verify CF proxy headers appear:
bash
curl -sI https://andersonhemmat.com/practice-areas/car-accident-lawyers | grep -E "cf-ray|server|cf-cache"Expected output:
cf-ray: 8xxx-ORD
server: cloudflare
cf-cache-status: DYNAMICIf you still see server: nginx, the orange cloud is not active yet.
Step 2: Create KV Namespaces
bash
# Create variants store
wrangler kv:namespace create "AI_VARIANTS"
# Note the ID returned
# Create visits log
wrangler kv:namespace create "AI_VISITS_LOG"
# Note the ID returnedStep 3: Load Variants into KV
From the anderson-hemmat-ai-visibility/ directory:
bash
# Load Markdown variant
wrangler kv:key put --binding=AI_VARIANTS "md" "$(cat variant-markdown.md)"
# Load Stripped HTML variant
wrangler kv:key put --binding=AI_VARIANTS "html" "$(cat variant-stripped-html.html)"
# Load Schema-heavy variant
wrangler kv:key put --binding=AI_VARIANTS "schema" "$(cat variant-schema-heavy.html)"Verify the uploads:
bash
wrangler kv:key list --binding=AI_VARIANTSExpected output:
json
[
{"name": "md"},
{"name": "html"},
{"name": "schema"}
]Step 4: Update wrangler.toml
Create wrangler.toml in the project directory:
toml
name = "anderson-hemmat-ai-variants"
main = "cloudflare-worker.js"
compatibility_date = "2026-01-01"
[[routes]]
pattern = "andersonhemmat.com/practice-areas/car-accident-lawyers*"
zone_name = "andersonhemmat.com"
[[kv_namespaces]]
binding = "AI_VARIANTS"
id = "<AI_VARIANTS_NAMESPACE_ID>"
[[kv_namespaces]]
binding = "AI_VISITS_LOG"
id = "<AI_VISITS_LOG_NAMESPACE_ID>"Replace <AI_VARIANTS_NAMESPACE_ID> and <AI_VISITS_LOG_NAMESPACE_ID> with the IDs from Step 2.
Step 5: Deploy
bash
wrangler deployVerify in Cloudflare dashboard: Workers and Pages > anderson-hemmat-ai-variants > Routes
Step 6: Test the Worker
Test with a known bot User-Agent:
bash
# Test with GPTBot UA
curl -sI "https://andersonhemmat.com/practice-areas/car-accident-lawyers" \
-H "User-Agent: GPTBot/1.0" | grep -E "x-variant|x-bot-type|x-bot-confidence|content-type"Expected response headers:
x-variant: md
x-bot-type: openai
x-bot-confidence: high
content-type: text/plain; charset=utf-8Test with ClaudeBot:
bash
curl -s "https://andersonhemmat.com/practice-areas/car-accident-lawyers" \
-H "User-Agent: ClaudeBot/1.0" | head -5Expected: Markdown content starting with # Denver Car Accident Lawyers
Test with human UA (should get normal page):
bash
curl -sI "https://andersonhemmat.com/practice-areas/car-accident-lawyers" \
-H "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36" | grep serverExpected: Normal origin headers (no x-variant header).
Step 7: Update variants (when content changes)
When firm adds new verdicts, new attorneys, or updated stats:
bash
# Update just the MD variant
wrangler kv:key put --binding=AI_VARIANTS "md" "$(cat variant-markdown-updated.md)"
# Worker automatically serves the new content — no redeploy neededTroubleshooting
| Problem | Check |
|---|---|
| Worker not firing | Verify route pattern includes * wildcard |
| Variant not served | Check KV namespace IDs in wrangler.toml match created namespaces |
| Human traffic getting variants | Check classifyRequest — bot score threshold may be too aggressive |
| 500 errors | Check wrangler tail for JS errors |
bash
# Watch live Worker logs
wrangler tail anderson-hemmat-ai-variants