Spectrum is for the services that don’t speak HTTP. SSH bastions, game servers, RDP gateways, custom TCP protocols, MQTT brokers, syslog over TCP — Cloudflare’s reverse proxy stack only handles HTTP/HTTPS, so any other listener either lives behind Spectrum or bypasses Cloudflare entirely. The trade-off versus Magic Transit is scope: Spectrum protects named services on specific ports; Magic Transit protects your whole prefix. This article covers how to set up Spectrum apps and when to reach for it instead of the other two options — for ops teams who own a non-HTTP service exposed to the internet.
How to verify
Confirm a Spectrum app is running and proxying correctly. The dashboard path is your zone → Spectrum → list of apps; via API:
# List Spectrum apps on a zone
curl -sS "https://api.cloudflare.com/client/v4/zones/${ZONE_ID}/spectrum/apps" \
-H "Authorization: Bearer ${CF_API_TOKEN}" | jq '.result[] | {protocol, dns, origin_direct}'
# DNS resolution should return Cloudflare anycast IPs, not your origin
dig +short ssh.example.com
# Expect: 104.x or 172.x range, NOT your real origin IP
# Connect to confirm proxying — the hostname resolves to CF, CF forwards to origin
ssh -v -p 2222 admin@ssh.example.com
# Look for "Connected to ssh.example.com" via the Cloudflare IP
# For UDP services, send a known query
dig @udp.example.com -p 5353 example.com
# Check origin sees Cloudflare-source IPs (or PROXY protocol header if enabled)
sudo tcpdump -ni eth0 'tcp port 22 and src net 104.16.0.0/12'
In Spectrum’s dashboard view: each app shows its listening protocol, edge port, origin target, and current connection count.
What’s happening
Cloudflare’s HTTP proxy stack — the one that sits behind orange-cloud DNS records — only understands HTTP, HTTP/2, HTTP/3, and WebSocket. Send anything else through that path and the request is rejected at the edge. Spectrum is a parallel proxy that opens raw TCP or UDP listeners on the anycast network, accepts whatever protocol you point at it, and forwards bytes to your origin without parsing them.
The practical consequence: Spectrum gives you the L3/L4 DDoS protection that any traffic on the Cloudflare network gets, the IP-hiding that the orange cloud gives HTTP, and Network-layer DDoS Managed Ruleset coverage — all for a service that the regular proxy can’t even see. The cost is that you configure it service-by-service. You tell Spectrum the protocol (tcp/22), the edge hostname (ssh.example.com), and the origin (10.0.5.3:22 or private.origin.internal:22). Cloudflare opens the listener, your DNS record (proxied) resolves to anycast, and connections to ssh.example.com:22 ride through the edge to your origin.
When to use what:
- Reverse proxy (orange cloud DNS record) — HTTP/HTTPS services on standard ports. Default for anything web.
- Spectrum — one or a handful of named non-HTTP services on specific ports. SSH, game servers, RDP, MQTT, custom protocols.
- Magic Transit — entire IP prefix, many services across many ports, or the requirement that origin sees real source IPs natively.
The procedure
Spectrum apps live at the zone level. A single zone can host many apps, each with its own protocol, edge hostname, and origin.
-
Create the DNS record for the edge hostname. Say you want SSH at
ssh.example.com. Add an A recordsshpointing at any of your origin IPs (Cloudflare will override the actual destination once the Spectrum app is bound). Proxy it (orange cloud). -
Create the Spectrum app. Dashboard: Spectrum → Create app. Or via API:
curl -sS -X POST \ "https://api.cloudflare.com/client/v4/zones/${ZONE_ID}/spectrum/apps" \ -H "Authorization: Bearer ${CF_API_TOKEN}" \ -H "Content-Type: application/json" \ -d '{ "protocol": "tcp/22", "dns": {"type": "CNAME", "name": "ssh.example.com"}, "origin_direct": ["tcp://10.0.5.3:22"], "ip_firewall": true, "proxy_protocol": "v2", "tls": "off", "argo_smart_routing": false }'Key fields:
protocolistcp/<port>orudp/<port>.origin_directis one or more origin endpoints (Cloudflare load-balances across them).proxy_protocol: "v2"injects the original client IP into a PROXY protocol header so your origin can log real source IPs. -
Configure the origin to expect PROXY protocol. OpenSSH doesn’t speak PROXY protocol natively, so you’ll need a small fronting layer (HAProxy, sslh, or a custom listener) on the origin if you want to see real client IPs. For game servers and RDP, check whether the server supports PROXY v2 directly.
-
Turn on IP Firewall. With
ip_firewall: true, Spectrum honours the same Zone IP Access Rules your HTTP traffic uses. This is how you geo-block or allowlist by ASN for non-HTTP services. -
Confirm the Network-layer DDoS Managed Ruleset is deployed for the zone (Security → DDoS → Network-layer DDoS Attack Protection). Spectrum-protected services count as Network-layer traffic for the ruleset’s purposes.
-
For services that need TLS termination at the edge — e.g. you want Cloudflare to handle the TLS handshake for a custom protocol — set
tls: "flexible"ortls: "full"and upload or use an edge certificate. For SSH and RDP, leave itoff: those protocols handle their own crypto.
Common pitfalls
- Forgetting to enable PROXY protocol on the origin listener — your logs fill with Cloudflare IPs and IP-based rate limiting on the origin is useless.
- Picking a port the Spectrum tier doesn’t allow on your plan — non-Enterprise Spectrum is limited to specific ports per protocol; check the plan matrix before you promise SSH on port 22.
- Pointing Spectrum at an origin that’s still in public DNS under a different name — anyone who finds the bypass hostname can connect direct, defeating the IP-hiding.
- Leaving the origin’s firewall wide open after migration — restrict to Cloudflare IP ranges (
https://www.cloudflare.com/ips/) once Spectrum is live. - Using Spectrum when you really need Magic Transit — if you have a dozen services on a dozen ports across several origins, the maintenance cost compounds.
For non-HTTP services that need DDoS protection without the network-team weight of Magic Transit, Stack Harbor operates Spectrum apps as part of managed operations — including the PROXY protocol fronting on the origin and the IP Access Rules that lock down direct access.