# Cloudflare Explorer URL - Quick Setup Guide

**Domain**: explorer.d-bis.org  
**Target**: http://192.168.11.140:80

---

## 🚀 Quick Setup (2 Steps)

### Step 1: Configure DNS Record

**In Cloudflare Dashboard** (https://dash.cloudflare.com/):

1. Select domain: **d-bis.org**
2. Go to: **DNS** → **Records**
3. Click: **Add record**
4. Configure:
   - **Type**: `CNAME`
   - **Name**: `explorer`
   - **Target**: `<your-tunnel-id>.cfargotunnel.com`
   - **Proxy status**: 🟠 **Proxied** (orange cloud) ← **REQUIRED**
   - **TTL**: Auto
5. Click: **Save**

**To find your tunnel ID:**
```bash
# Run this script
./scripts/get-tunnel-id.sh

# Or check Cloudflare Zero Trust dashboard:
# https://one.dash.cloudflare.com/ → Zero Trust → Networks → Tunnels
```

---

### Step 2: Configure Tunnel Route

**In Cloudflare Zero Trust Dashboard** (https://one.dash.cloudflare.com/):

1. Navigate to: **Zero Trust** → **Networks** → **Tunnels**
2. Find your tunnel (by ID or name)
3. Click: **Configure** button
4. Click: **Public Hostnames** tab
5. Click: **Add a public hostname**
6. Configure:
   - **Subdomain**: `explorer`
   - **Domain**: `d-bis.org`
   - **Service**: `http://192.168.11.140:80`
   - **Type**: `HTTP`
7. Click: **Save hostname**

---

## ✅ Verify

**Wait 1-5 minutes for DNS propagation, then test:**

```bash
# Test public URL
curl https://explorer.d-bis.org/api/v2/stats

# Should return JSON with network stats (not 404)
```

---

## 📋 Configuration Checklist

- [ ] DNS CNAME record: `explorer` → `<tunnel-id>.cfargotunnel.com`
- [ ] DNS record is **🟠 Proxied** (orange cloud)
- [ ] Tunnel route: `explorer.d-bis.org` → `http://192.168.11.140:80`
- [ ] Cloudflared service running in container
- [ ] Public URL accessible: `https://explorer.d-bis.org`

---

## 🔧 Troubleshooting

### 404 Error
- Check DNS record exists and is proxied
- Check tunnel route is configured
- Wait 5 minutes for DNS propagation

### 502 Error
- Verify tunnel route points to `http://192.168.11.140:80`
- Check Nginx is running: `systemctl status nginx` (in container)
- Check Blockscout is running: `systemctl status blockscout` (in container)

---

**That's it! Follow these 2 steps and your public URL will work.**

