Cloudflare Docs
Spectrum
Edit this page
Report an issue with this page
Log into the Cloudflare dashboard
Set theme to dark (⇧+D)

Get started

Spectrum is available on all paid plans. Pro and Business support selected protocols only, whereas Enterprise supports all TCP and UDP based traffic. Refer to Configuration options for more configuration details.

To create a Spectrum application, you can either use an IP address, a CNAME Record or a load balancer. Independently of the method you use, you can create the application through the dashboard or via API.

​​ Create a Spectrum application using an IP address

To create a Spectrum application using an IP address, Cloudflare normally assigns you an arbitrary IP from Cloudflare’s IP pool to your application. If you want to use your own IP addresses, you can use BYOIP or you can also use a Static IP. In these two last cases, you need to create your Spectrum application through the API, as these features are not available via dash. When using the API, the field origin_direct takes as input the IP address.

Add your application via Dashboard
  1. Log in to the Cloudflare dashboard.
  2. Select Spectrum.
  3. Select Create an Application. If this is your first time using Spectrum, the Create an Application modal appears.
  4. Select your Application Type.
  5. Under Domain, enter the domain that will use Spectrum.
  6. Under Edge Port, enter the port Cloudflare should use for your application.
  7. Under Origin, enter your application’s origin IP and port.
  8. If your application requires the client IP and supports Proxy Protocol, enable Proxy Protocols. Proxy Protocol is a method for a proxy like Cloudflare to send the client IP to the origin application.
  9. Select Add.
Add your application via API

Below is a curl example and the associated data being posted to the API.

API example:

curl "https://api.cloudflare.com/client/v4/zones/{zone_id}/spectrum/apps" \
--header "X-Auth-Email: <EMAIL>" \
--header "X-Auth-Key: <API_KEY>" \
--header "Content-Type: application/json" \
--data '{"protocol":"tcp/22","dns":{"type":"CNAME","name":"ssh.example.com"},"origin_direct":["tcp://192.0.2.1:22"],"proxy_protocol":"off","ip_firewall":true,"tls":"full","edge_ips":{"type":"dynamic","connectivity":"all"},"traffic_type":"direct","argo_smart_routing":true}'

Example data:

{
"success": true,
"errors": [],
"messages": [],
"result": {
"id": "ea95132c15732412d22c1476fa83f27a",
"protocol": "tcp/22",
"dns": {
"type": "CNAME",
"name": "ssh.example.com"
},
"origin_direct": [
"tcp://192.0.2.1:22"
],
"proxy_protocol": "off",
"ip_firewall": true,
"tls": "full",
"edge_ips": {
"type": "dynamic",
"connectivity": "all"
},
"traffic_type": "direct",
"argo_smart_routing": true,
"created_on": "2014-01-02T02:20:00Z",
"modified_on": "2014-01-02T02:20:00Z"
}
}

​​ Create a Spectrum application using a CNAME record

To create a Spectrum application using a CNAME record, you will need to create a CNAME record on your Cloudflare hosted zone that points to your origin’s hostname. This is required to resolve to your hostname origin. Refer to Create DNS records, for more information. When using a CNAME as an origin, note that Cloudflare needs to be authoritative for that zone. When using the API, the origin_dns field takes as input the CNAME record.

Add your application via Dashboard
  1. Log in to the Cloudflare dashboard.
  2. Select Spectrum.
  3. Select Create an Application. If this is your first time using Spectrum, the Create an Application modal appears.
  4. Select your Application Type.
  5. Under Domain, enter the domain that will use Spectrum.
  6. Under Edge Port, enter the port Cloudflare should use for your application.
  7. Under Origin, enter your CNAME record name.
  8. Select Add.
Add your application via API

Below is a curl example and the associated data being posted to the API.

API example:

curl 'https://api.cloudflare.com/client/v4/zones/{zone_id}/spectrum/apps' \
--header "X-Auth-Email: <EMAIL>" \
--header "X-Auth-Key: <API_KEY>" \
--header "Content-Type: application/json" \
--data '{"dns":{"type":"CNAME","name":"spectrum-cname.example.com"},"ip_firewall":false,"protocol":"tcp/22","proxy_protocol":"off","tls":"off","origin_dns": {"name": "cname-to-origin.example.com", "ttl": 1200}, "origin_port": 22}'

Example data:

{
"dns": {
"type": "CNAME",
"name": "spectrum-cname.example.com"
},
"ip_firewall": false,
"protocol": "tcp/22",
"proxy_protocol": "off",
"tls": "off",
"origin_dns": {
"name": "cname-to-origin.example.com",
"ttl": 1200
},
"origin_port": 22
}

​​ Create a Spectrum application using a load balancer

To create a Spectrum application using a load balancer, you will need to generate a load balancer from the dashboard or via the API. Refer to the Load Balancing documentation for more details.

Add your application via Dashboard
  1. Log in to the Cloudflare dashboard.
  2. Select Spectrum.
  3. Select Create an Application. If this is your first time using Spectrum, the Create an Application modal appears.
  4. Select your Application Type.
  5. Under Domain, enter the domain that will use Spectrum.
  6. Under Edge Port, enter the port Cloudflare should use for your application.
  7. Under Origin, select Load Balancer.
  8. Select the load balancer you want to use from the dropdown. Disabled load balancers will not show on the Load Balancer menu.
  9. Select Add.
Add your application via API

Below is a curl example and the associated data being posted to the API.

API example:

curl "https://api.cloudflare.com/client/v4/zones/{zone_id}/spectrum/apps" \
--header "X-Auth-Email: <EMAIL>" \
--header "X-Auth-Key: <API_KEY>" \
--header "Content-Type: application/json" \
--data '{"dns":{"type":"CNAME","name":"spectrum-cname.example.com"},"ip_firewall":false,"protocol":"tcp/22","proxy_protocol":"off","tls":"off","origin_dns": {"name": "cname-to-origin.example.com", "ttl": 1200}, "origin_port": 22}'

Example data:

{
"dns": {
"type": "CNAME",
"name": "spectrum-cname.example.com"
},
"ip_firewall": false,
"protocol": "tcp/22",
"proxy_protocol": "off",
"tls": "off",
"origin_dns": {
"name": "cname-to-origin.example.com",
"ttl": 1200
},
"origin_port": 22
}

​​ View traffic

You can now proxy traffic through Cloudflare without additional configuration. As you run traffic through Cloudflare, you will see the last minute of traffic from Spectrum in the dashboard.

If you have any feedback, please let us know.