Z.eus

Chiu Yau's Log.

Cloudflare Allowed Ports with Proxy Enabled

Disclaimer: This is an copy of Network ports ยท Cloudflare Fundamentals docs

Network ports

Learn which network ports Cloudflare proxies by default and how to enable Cloudflareโ€™s proxy for additional ports.

โ€‹โ€‹Network ports compatible with Cloudflareโ€™s proxy

By default, Cloudflare proxies traffic destined for the HTTP/HTTPS ports listed below.HTTP ports supported by Cloudflare

  • 80
  • 8080
  • 8880
  • 2052
  • 2082
  • 2086
  • 2095

HTTPS ports supported by Cloudflare

  • 443
  • 2053
  • 2083
  • 2087
  • 2096
  • 8443

Ports supported by Cloudflare, but with caching disabled

โ€‹โ€‹How to enable Cloudflareโ€™s proxy for additional ports

If traffic for your domain is destined for a different port than the ones listed above, for example you have an SSH server that listens for incoming connections on port 22, either:

  • Change your subdomain to be gray-clouded, via your Cloudflare DNS app, to bypass the Cloudflare network and connect directly to your origin.
  • Configure a Spectrum application for the hostname running the server. Spectrum supports all ports. Spectrum for all TCP and UDP ports is only available on the Enterprise plan. If you would like to know more about Cloudflare plans, please reach out to your Cloudflare account team.

โ€‹โ€‹How to block traffic on additional ports

Block traffic on ports other than 80 and 443 in Cloudflare paid plans by doing one of the following:

  • If you are using WAF managed rulesOpen external link, enable rule ID 100015: โ€œAnomaly:Port – Non Standard Port (not 80 or 443)โ€.
  • If you are using the new Cloudflare Web Application Firewall (WAF), create a custom rule for this purpose (rule ID 100015 was deprecated in the new WAF). For example, you could use a rule configuration similar to the following:
    • Expression: not (cf.edge.server_port in {80 443})
    • Action: Block

Ports 80 and 443 are the only ports compatible with:

Due to the nature of Cloudflareโ€™s Anycast network, ports other than 80 and 443 will be open so that Cloudflare can serve traffic for other customers on these ports. Tools like Netcat will report these non-standard HTTP ports as open.

WAF managed rules or the new Cloudflare Web Application Firewall (WAF) will block traffic at the application layer (layer 7 in the OSI modelOpen external link), preventing HTTP/HTTPS requests over non-standard ports from reaching the origin server.Cloudflare Access does not support port numbers in URLs. Port numbers are stripped from requests for URLs protected through Cloudflare Access.


Leave a Reply

Your email address will not be published. Required fields are marked *