Updated Nov 17, 2026· 15 min read

Key takeaways

  • Best source IP ranges for HTTPS traffic: Cloudflare IPv4 and IPv6 lists, CIDR sizes, private ranges, allowlist rules for port 443, refresh and logging tips.

An HTTPS server that accepts traffic from every address on the internet invites direct attacks that skip the proxy, the firewall rules, and the rate limits in front of it. The best source IP ranges for HTTPS traffic are the narrow, published ranges that should reach port 443, with everything else denied at the origin firewall.

Quick verdict

For a site behind Cloudflare, allow the 15 published IPv4 blocks and the 7 published IPv6 blocks on port 443, deny all other traffic to that port, and refresh the list from the published endpoints on a weekly schedule. That single rule closes the direct path to the origin.

Source range Best for Size Key spec Main limit
Cloudflare IPv4 ranges Proxied public sites 15 CIDR blocks Port 443, TCP Shared by all customers
Cloudflare IPv6 ranges IPv6 visitors 7 CIDR blocks Port 443, TCP List changes over time
Private RFC 1918 ranges Internal HTTPS services 3 blocks Never routed on the public internet Needs NAT for outside access
Single host /32 range One admin or one server 1 address Exact host route Breaks when the address changes
Small office /24 range One office or branch 256 addresses, 254 usable Mask 255.255.255.0 Too wide for one person
Medium /22 range Office or school network 1,024 addresses, 1,022 usable Mask 255.255.252.0 Covers many unused hosts
Large /20 and /16 ranges Campus and cloud subnets 4,096 and 65,536 addresses Masks 255.255.240.0 and 255.255.0.0 Far too wide for a public allowlist

How we selected

We selected these ranges from the published Cloudflare address lists, a CIDR reference that gives exact block sizes and masks, and a guide to allowlisting at the origin. We compared the published IPv4 and IPv6 blocks, the private address blocks, and the CIDR sizes before choosing the ranges below.

Source IP ranges for HTTPS traffic compared

Each range below serves a different traffic path, and the right choice depends on where the HTTPS request comes from. Read the block size and the port with each range, because a range that is right for a proxy is wrong for a single admin user, and the wrong choice can block real visitors.

Cloudflare IPv4 ranges for HTTPS traffic

The Cloudflare IPv4 ranges are the 15 CIDR blocks that Cloudflare publishes for its proxy network, and they are the source ranges to allow on port 443 when a site is proxied through Cloudflare. Each block is a slice of that network, and the rule should name all 15 together.

The published list reads 173.245.48.0/20, 103.21.244.0/22, 103.22.200.0/22, 103.31.4.0/22, 141.101.64.0/18, 108.162.192.0/18, 190.93.240.0/20, 188.114.96.0/20, 197.234.240.0/22, 198.41.128.0/17, 162.158.0.0/15, 104.16.0.0/13, 104.24.0.0/14, 172.64.0.0/13, and 131.0.72.0/22.

Those blocks cover a wide span of sizes. A /22 block holds 1,024 addresses, a /20 block holds 4,096 addresses, a /18 block holds 16,384 addresses, and a /13 block holds 524,288 addresses, using the rule that total addresses equal 2 raised to the power of 32 minus the prefix length. The largest blocks in the list, 104.16.0.0/13 and 172.64.0.0/13, are the ones that carry the most proxied traffic, while the /22 blocks are smaller slices of the same network.

The rule at the origin is simple in shape: allow the fetched ranges on ports 80 and 443, then set the default policy for those ports to deny. That shape is the same in a host firewall, in nftables, and in a cloud security group. In a cloud security group, the work is one inbound rule per range for port 443, with the 0.0.0.0/0 rule that most defaults ship with removed. In a host firewall, the work is one allow rule per range, followed by a deny rule for all other traffic to ports 80 and 443.

Use this range set if the site is proxied and the origin should only hear from the proxy. Skip it if the site is served directly, because no proxy traffic will arrive and the allowlist will block real visitors. The main limit is sharing: every Cloudflare customer uses the same ranges, so an allowlist proves a request came through the Cloudflare network, not that it came through your own zone rules. Add Authenticated Origin Pulls and Host header validation to close that gap.

Cloudflare IPv6 ranges for HTTPS traffic

The Cloudflare IPv6 ranges are the 7 CIDR blocks that Cloudflare publishes for IPv6 proxy traffic, and they must be allowed alongside the IPv4 list. The published list reads 2400:cb00::/32, 2606:4700::/32, 2803:f800::/32, 2405:b500::/32, 2405:8100::/32, 2a06:98c0::/29, and 2c0f:f248::/32.

IPv6 blocks are far larger than IPv4 blocks at the same prefix length, because an IPv6 address has 128 bits instead of 32. A /32 IPv6 block holds a vast number of addresses, yet it is still a single named slice of the Cloudflare network, and the firewall counts it as one rule. That is why the list has only 7 blocks: each one covers a large part of the network, and together they cover the IPv6 traffic that the proxy sends to origins.

Leaving IPv6 out is a common mistake. Cloudflare serves a large share of traffic over IPv6, and a firewall that only allows the IPv4 ranges will block real IPv6 visitors while the site looks fine over IPv4. The fix is to fetch both lists, IPv4 and IPv6, from the same published endpoints, and to add both sets of rules to the same port 443 policy. The refresh script should pull both lists in one pass, so a change in either list is picked up at the same time.

Use this range set together with the IPv4 set whenever the site is proxied, because visitors arrive over both protocols. Skip a separate IPv6 policy only when the server has no IPv6 address at all, and even then keep the list on file for the day IPv6 is enabled. The main limit is change: the list is versioned and changes over time, so a copy pasted once will go stale, and a stale copy can block real traffic or leave an old range open.

Private RFC 1918 ranges for internal HTTPS

The private RFC 1918 ranges are the three blocks reserved for private networks, and they are the right source ranges for internal HTTPS services that should never face the public internet. The blocks are 10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16, and they are never routed on the public internet.

Their sizes differ sharply. The 10.0.0.0/8 block holds 16,777,216 addresses, with 16,777,214 usable hosts, and it suits large enterprise networks and cloud VPCs. The 172.16.0.0/12 block holds 1,048,576 addresses, with 1,048,574 usable hosts, and it suits medium corporate networks. The 192.168.0.0/16 block holds 65,536 addresses, with 65,534 usable hosts, and it suits home routers and small offices. A home router assigns addresses from 192.168.0.0/16, which is why devices on a home network have addresses like 192.168.1.5.

Private ranges need NAT to reach the internet, because a private address is not routable outside the local network. That property is useful for an internal HTTPS service: allow the private range on port 443 inside the network, and deny the same port from the public internet, and the service stays reachable to staff while staying hidden from outside scanners. The 172 range covers 172.16 to 172.31 only, so 172.32.0.0/16 is not private and should not be treated as one.

Use these ranges for internal dashboards, internal APIs, and services that sit behind a VPN or a private network. Skip them for a public website, because a public visitor will never arrive from a private address. The main limit is scope: a private range is only valid inside the network that owns it, and the same block can exist in many networks at once without conflict.

Single host /32 range for one admin

A /32 range is a single host, and it is the narrowest source range that can be written for HTTPS traffic. The CIDR table gives a /32 a subnet mask of 255.255.255.255, with 1 total address and 0 usable hosts in the usual host count, because it is a host route rather than a network with a network and broadcast address.

Cloud providers assign single addresses as /32 host routes, and the guide gives 203.0.113.42/32 as an example of exactly one address with no network or broadcast overhead. That form suits a single admin workstation, a single monitoring server, or a single partner system that needs HTTPS access to an admin panel. The rule is one address, one port, and no other source, which makes the audit trail simple: every allowed connection came from that one address.

The weakness is change. A home broadband address can change, a laptop can move to a new network, and a cloud instance can be rebuilt with a new address, and each change breaks the rule until it is updated. A /32 also gives no room for a second admin or a backup system, so it suits a single fixed source rather than a team. For a team, a small /29 or /28 block is a better fit, because it covers a handful of addresses without opening a whole office range.

Use a /32 when the source is fixed, known, and few in number, and when the cost of an outage from an address change is low. Skip it for a public site, for a roaming team, or for any service where the source address changes often. The main limit is fragility: the rule is exact, and an exact rule fails closed when the address moves.

Small office /24 range for HTTPS traffic

A /24 range holds 256 addresses, with 254 usable hosts, and it is the standard size for a small office or branch network. The subnet mask is 255.255.255.0, and the block covers a single last-octet range, such as 192.168.1.0 to 192.168.1.255, with the first address as the network address and the last as the broadcast address.

Most home routers use 192.168.1.0/24, with a network address of 192.168.1.0, a broadcast address of 192.168.1.255, usable hosts from 192.168.1.1 to 192.168.1.254, and the router itself typically at 192.168.1.1. That layout is familiar, and it is easy to audit: the whole office sits in one block, and the firewall rule names that block. A corporate division can use the same pattern, giving one department 10.0.1.0/24 with 254 hosts, another 10.0.2.0/25 with 126 hosts, and a guest network 10.0.3.0/26 with 62 hosts.

A /24 is a good fit for an office that needs HTTPS access to an internal service, or for a branch that sends traffic through a fixed public address range. It is too wide for a single person, because it allows 254 hosts when only one is needed, and an attacker who gains a foothold on any host in the range gains the same HTTPS access. That trade is worth it when the office network is trusted and managed, and it is not worth it when the range covers untrusted devices.

Use a /24 when the source is a whole office or branch with a stable public range, and when the network inside that range is managed. Skip it when only one or two people need access, because a /32 or a /29 covers them with far less exposure. The main limit is breadth: the rule allows the whole office, not just the people who need HTTPS access.

Medium /22 range for larger networks

A /22 range holds 1,024 addresses, with 1,022 usable hosts, and it suits an office or school network that has outgrown a /24. The subnet mask is 255.255.252.0, and the block spans four /24 ranges, such as 10.42.8.0 to 10.42.11.255, with usable hosts from 10.42.8.1 to 10.42.11.254.

The math follows the same rule as every CIDR block: total addresses equal 2 raised to the power of 32 minus the prefix length, so a /22 has 10 host bits and 2 to the power of 10 equals 1,024 addresses. Usable hosts equal total addresses minus 2, because one address is reserved for the network and one for broadcast. That is why a /22 gives 1,022 usable hosts, a /21 gives 2,046, and a /20 gives 4,094.

A /22 is a useful size for a site that needs to allow a partner network or a campus segment to reach an HTTPS service, because it covers a whole segment without naming every host. It is too wide for a public allowlist, because it allows more than a thousand addresses when the real need may be a handful of servers. The guide notes that a /22 is a typical size for an office or school network, and that a /20 is a typical size for a cloud VPC subnet tier or a large office.

Use a /22 when the source is a known network segment with a stable range, and when the segment is managed and trusted. Skip it for a public HTTPS allowlist, because the exposure is far larger than the need. The main limit is the gap between the range and the real users: most of the 1,022 hosts will never need HTTPS access, yet the rule allows them all.

Large /20 and /16 ranges for campus and cloud

A /20 range holds 4,096 addresses, with 4,094 usable hosts, and a /16 range holds 65,536 addresses, with 65,534 usable hosts. The /20 mask is 255.255.240.0, and the /16 mask is 255.255.0.0. Those sizes suit campus networks, cloud VPC subnets, and large enterprise segments, where thousands of hosts share one block.

The /16 size is the same size as the whole 192.168.0.0/16 private block, which covers 192.168.0.0 to 192.168.255.255. A /20 is a smaller slice, covering 16 /24 ranges, while a /16 covers 256 /24 ranges. A company that receives 10.0.0.0/16 can divide it into an IT department at 10.0.1.0/24, finance at 10.0.2.0/25, WiFi guests at 10.0.3.0/26, and VoIP phones at 10.0.4.0/28, which shows how a large block is split into useful pieces rather than used whole.

Large ranges are planning tools, not allowlist entries for a public HTTPS service. Allowing a whole /16 on port 443 would allow 65,534 hosts, which is far wider than any real set of HTTPS clients, and it would hide the real sources in a sea of unused addresses. The right use is to carve the large block into /24, /25, and /26 pieces, and to allow only the pieces that need HTTPS access.

Use /20 and /16 ranges for network planning, VPC design, and internal segmentation, where the goal is to give each segment room to grow. Skip them as direct source ranges for a public HTTPS allowlist, because the exposure is far too wide. The main limit is scale: a large range is easy to write and hard to audit, and it invites the exact over-permissive rule that an allowlist is meant to avoid.

Buying guide

Choosing a source range is a network decision, not a guess, and the rules below turn a list of CIDR blocks into a firewall policy that stays correct as addresses change and teams grow. Start with the source of the list, then the rule shape, then the extra checks.

Fetch the list from the source, do not copy it in the best source ip ranges for https traffic

Cloudflare publishes its ranges as plain text, one CIDR per line, at the IPv4 and IPv6 endpoints, and the guide warns against copying the ranges from a blog post, because the list is versioned and changes. A firewall recipe should pull from those endpoints, not embed a copy.

The list changes a few times a year, and the update history shows a block removed in 2017, a /12 block replaced by a /13 and a /14 block in 2021, and an IPv6 block removed in 2022 and added back in 2023. A missed range means Cloudflare requests from that range are blocked, so a stale list can cause an outage for real visitors. A weekly refresh is plenty, and the script should fail loudly if the fetch returns an empty list, because an empty allowlist plus a deny policy blocks all web traffic.

Allow 443, then deny the rest

The shape of the rule is the same in every tool: allow the fetched ranges on ports 80 and 443, then set the default policy for those ports to deny. In UFW, that means one allow rule per range for TCP ports 80 and 443, followed by a deny rule for all other traffic.

Keep SSH and other services on their own rules, limited to your own addresses or a VPN, and do not mix them into the web rule. A site that only needs HTTPS can use a 443-only rule at the origin firewall, while a site that still serves HTTP for a redirect needs both 80 and 443. Do not remove an existing public 443 rule until the Cloudflare rules are installed and the site has been checked through Cloudflare, or the change can cause an outage.

Do not trust the allowlist alone

An allowlist proves a request came through the Cloudflare network, and it does not prove it came through your zone rules, because every customer shares the same ranges. An attacker can put your origin address behind their own Cloudflare zone, with no firewall rules, and still arrive from an allowed range.

Two additions close the gap. Authenticated Origin Pulls makes Cloudflare present a client certificate when it connects to the origin, and the origin web server is set to require that certificate, so requests through another zone are rejected at the TLS handshake. Host header validation makes the web server serve only requests whose Host header matches your hostnames, and return an error for anything else. With all three in place, the origin is only reachable by Cloudflare acting for your zone.

Restore the real visitor address safely

Behind a proxy, the source address the web server sees is the proxy address, so access logs, rate limits, and geo rules at the origin key on the wrong value. Cloudflare sends the visitor address in the CF-Connecting-IP header, and the server should trust it only from an allowed range.

In nginx, the setup uses one set_real_ip_from line per Cloudflare range, plus a real_ip_header line naming CF-Connecting-IP, with the ranges kept up to date from the same published list. That setup restores the real visitor address for logging and rate limiting, while keeping the trust tied to the allowlist. The same idea applies in Apache, where the trusted proxy list should name the same ranges and no other source.

Log the Ray ID with each request

Every request that passes through Cloudflare gets a Ray ID, a 16-character hex string with a data centre code appended, such as 8a1b2c3d4e5f6a7b-LHR. It is returned in the cf-ray response header, shown on error pages, and recorded in Cloudflare logs.

Its purpose is correlation: a visitor reports an error page and reads the Ray ID, the operator searches for it in the zone request logs, and the trail leads to the specific request, the rule that matched, the origin response code, and the timing. Logging cf-ray in the origin access logs beside your own request ID joins the Cloudflare view of a request to the origin view, and it is worth the one line of configuration that it takes. The zone ID and account ID are separate identifiers, found in the dashboard overview, and used only for API calls.

FAQ

These answers cover the questions that come up most often when a reader plans a source IP allowlist for HTTPS, from where to fetch the list to how often to refresh it. Use them to settle the source, the refresh schedule, the logging setup, and the real visitor address.

Where do I get the current Cloudflare IP ranges?

From the endpoints Cloudflare publishes, the IPv4 endpoint and the IPv6 endpoint, which return one CIDR per line. The IP ranges page on the Cloudflare site shows the same list, and scripts should fetch it rather than embed a copy, because the list changes over time.

Is allowlisting Cloudflare IPs enough to protect my origin?

No. The ranges are shared by every Cloudflare customer, so a request from an allowed range only proves it passed through the Cloudflare network, not through your zone rules. Add Authenticated Origin Pulls and Host header validation to close that gap.

How often should I refresh the allowlist?

Weekly is sufficient, because the list changes a few times a year. Automate the refresh, and make the script abort if the fetch returns an empty result, because an empty allowlist combined with a deny rule blocks all web traffic, so the script must fail loudly on an empty fetch.

What does a /24 range allow on port 443?

A /24 range allows 256 addresses, with 254 usable hosts, on the port named in the rule. For a home network at 192.168.1.0/24, that means usable hosts from 192.168.1.1 to 192.168.1.254, with 192.168.1.0 as the network address and 192.168.1.255 as broadcast.

How do I see the real visitor IP behind Cloudflare?

Read the CF-Connecting-IP header, and set the web server to trust it only for connections from Cloudflare ranges, for example with nginx set_real_ip_from lines and a real_ip_header directive. Trusting the header from any source lets direct requesters spoof their address.

Conclusion

Allow the 15 Cloudflare IPv4 blocks and the 7 IPv6 blocks on port 443, deny all other traffic to that port, fetch the list weekly from the published endpoints, and add Authenticated Origin Pulls and Host validation. That policy keeps HTTPS traffic on the proxy path and the origin out of direct reach.

A
admin88
We compare specs, materials and verified owner reviews before a product earns a spot. Rankings are never paid.
Affiliate disclosure. As an Amazon Associate we earn from qualifying purchases at no extra cost to you. Prices accurate as of the date shown.