Behind a proxied Cloudflare record, which ports reach the origin, and what do an SSH host and a UDP game server need instead?
answer
- two short port lists
- some ports skip the cache
- port 22 and UDP get dropped
- TCP and UDP need another product
basics
~20 sA proxied Cloudflare record accepts HTTP on 80, 8080, 8880, 2052, 2082, 2086, 2095 and HTTPS on 443, 2053, 2083, 2087, 2096, 8443; SSH, UDP game traffic and other ports are dropped, so those hosts need DNS-only or Spectrum.
solid answer
~40 sCloudflare's HTTP proxy listens on a fixed set of ports: HTTP on `80`, `8080`, `8880`, `2052`, `2082`, `2086`, `2095` and HTTPS on `443`, `2053`, `2083`, `2087`, `2096`, `8443`. Only `80`, `8080` and `443` are cached by default; the others are proxied with caching disabled unless an Enterprise zone turns it on with a Cache Rule. A web app listening on another port, say 9000, keeps visitors on 443 and uses an Origin Rule destination port override. Non-HTTP services are different: SSH on 22, FTP, RDP or a game server on UDP sent to a proxied name land on Cloudflare, which drops the connection. Those records must be **DNS-only**, which exposes their IP, or be fronted by **Spectrum**, which proxies TCP and UDP and covers every port only on the Enterprise plan.
code
plaintext · 6 linesType Name Content Proxy status Traffic
A @ 192.0.2.10 Proxied HTTPS on 443
CNAME www example.com Proxied HTTPS on 443
A api 192.0.2.10 Proxied HTTPS on 443, Origin Rule to port 9000
A ssh 198.51.100.7 DNS only SSH on 22, separate IP
A play 198.51.100.8 DNS only UDP game traffic, separate IPgo deeper
Remember that the proxy carries HTTP and HTTPS only, on 80 and 443 plus a short list of extra ports, and that SSH or a game server needs a DNS-only record.
Name both port lists, say which ports are cached by default, and explain how an Origin Rule lets visitors stay on 443 while the origin listens elsewhere.
Plan the zone so non-HTTP services sit on separate IPs, so gray-clouded names never reveal the web origin, and say when Spectrum or a Tunnel is worth it.
Weigh the cost of Spectrum on Enterprise against moving administrative protocols behind Tunnel and Access and keeping only a few DNS-only service records.
## The proxy only speaks HTTP and HTTPS Setting a record to **Proxied** makes DNS answer with Cloudflare anycast addresses. Whatever a client sends to those addresses arrives at Cloudflare's HTTP proxy, which accepts HTTP and HTTPS on a published list of ports and nothing else. A connection on another port, or in another protocol, reaches Cloudflare and goes no further: Cloudflare's proxy drops non-HTTP connections. So the proxy status of a record is really a decision about **every service that shares the name**, not just the website. ## The ports a proxied record serves | Protocol | Ports proxied by default | Cached by default | |---|---|---| | HTTP | `80`, `8080`, `8880`, `2052`, `2082`, `2086`, `2095` | `80`, `8080` | | HTTPS | `443`, `2053`, `2083`, `2087`, `2096`, `8443` | `443` | Points worth knowing: - **Caching on the extra ports is off.** Requests on `2052`, `2053`, `2082`, `2083`, `2086`, `2087`, `2095`, `2096`, `8880` and `8443` are proxied and filtered but not cached. Enterprise zones can enable caching on them with a Cache Rule. - **Blocking the extra ports.** On paid plans the Cloudflare Managed Ruleset has a rule, disabled by default, named `Anomaly:Port - Non Standard Port (not 80 or 443)`, which blocks HTTP and HTTPS requests on any port other than 80 and 443. - **China Network.** Only `80` and `443` work inside China data centers for zones with the China Network enabled. - **Cloudflare Access** strips port numbers from protected URLs, so an Access-protected app should be served on a standard port. ## A web app on an unlisted port Visitors do not have to use the origin's port. If the application listens on, say, `9000`, the usual fix keeps visitors on `https://app.example.com` (port 443) and adds an **Origin Rule** with a destination port override, so Cloudflare connects to the origin on 9000. Origin Rules are covered with request rules; the point here is that the visitor-facing port must be one of the proxied ones. ## Services that are not HTTP Records for SSH, FTP, RDP, SMTP, database ports and game servers cannot simply be proxied. There are three honest options: 1. **DNS-only record.** The client connects straight to the server. It works with any protocol, but the server's IP is published and none of Cloudflare's protection applies. If that server is also the web origin, the DNS-only name leaks the web origin's address too, so put such services on a separate IP. 2. **Spectrum.** Cloudflare's product for proxying TCP and UDP applications, and HTTP on non-standard ports, through its network with DDoS protection. Spectrum for all TCP and UDP ports is available only on the Enterprise plan; Spectrum applications manage their own DNS records. 3. **Cloudflare Tunnel.** For administrative access such as SSH or RDP, a Tunnel connector at the origin publishes the service without an open inbound port. Tunnels are covered with Tunnel connectors; they replace the public record rather than proxying it. | Option | Origin IP public | What Cloudflare adds | |---|---|---| | DNS-only record | Yes | Nothing beyond DNS | | Spectrum application | No | Proxying and DDoS protection for TCP and UDP | | Cloudflare Tunnel | No, and no inbound port is opened | Reachability only through Cloudflare, where Access policies can be added | ## A worked zone A company moving onto Cloudflare with a website on the apex and `www`, an API, an SSH bastion and a game server on UDP would end up with something like the plan in the code example: the web names proxied, the SSH and game names DNS-only on their own addresses, unless the business pays for Spectrum or moves SSH behind a Tunnel. ## Common mistakes - Proxying `ssh.example.com` because "everything should be orange": every SSH session then fails at Cloudflare. - Serving an API on `:3000` behind a proxied name and wondering why clients cannot connect: 3000 is not on the list. - Moving an HTTPS app to `8443` and finding it is no longer cached: the extra ports are proxied with caching disabled. - Gray-clouding the game server on the same IP as the website and leaking the web origin.
- Why does moving a proxied site from port 443 to 8443 change its cache hit ratio?Cloudflare proxies `8443` but with caching disabled by default, as it does for `2053`, `2083`, `2087`, `2096`, `2052`, `2082`, `2086`, `2095` and `8880`. Only `80`, `8080` and `443` are cached by default. An Enterprise zone can turn caching on for those ports with a Cache Rule; other plans should serve cached content on a standard port.
- Can a proxied Cloudflare zone refuse HTTP requests on its extra ports altogether?Yes, on paid plans. The Cloudflare Managed Ruleset includes `Anomaly:Port - Non Standard Port (not 80 or 443)`, disabled by default; enabling it blocks HTTP and HTTPS requests on every port except 80 and 443 at the application layer.
- A proxied record forwards traffic on every port to the origin unchanged.
- Proxying the SSH host's record adds DDoS protection to SSH sessions.
- Every proxied port is cached exactly like port 443.
- Spectrum for any TCP or UDP port is included on the Free plan.
- Visitors must connect on the same port the origin application listens on.