Key takeaways
- Learn how IP ranges and allow lists work for web traffic on ports 80 and 443, from CIDR basics to CDN ranges and keeping origin rules current.
Restricting web traffic by IP range sounds simple until you sit in front of the firewall rule and have to decide which networks may reach your server on ports 80 and 443. Allow too little and real visitors, health checks or your own CDN get turned away. Allow too much and the rule does nothing at all. The real decision is which networks you trust to speak to your web service, where you enforce that trust, and how the list stays accurate afterwards.
This guide is for site owners, administrators and developers who need to allow web traffic by source range rather than leaving an origin server open to the whole internet. It explains how ranges are written, where providers publish the ranges their services send traffic from, how allow lists behave at a firewall, a load balancer and a web server, and how to keep those lists current. Everything here is general practice, because exact ranges always come from your provider’s own documentation, never from a guide.
As an Amazon Associate we earn from qualifying purchases.
How to Choose
Start With CIDR and What a Range Really Covers
An IP range is a block of addresses written in CIDR notation, such as a single address with a /32 suffix at one extreme and a large block with a short prefix at the other. The number after the slash states how many of the address bits are fixed, so a smaller number means a wider block and a larger number means a narrower one. Before you allow anything, translate every range you are given into plain language: how many addresses it contains, which organisation controls it, and whether it is IPv4, IPv6 or one of each. Providers publish separate lists for the two versions, and a rule set that covers only IPv4 quietly leaves the IPv6 door in a different state than you intended. Remember also what a range is not. It identifies a network, not a person, a company or a customer account. Many unrelated senders can sit behind one shared address through network address translation, and one large sender can originate from thousands of addresses. Treat a range as a coarse filter that narrows who can even knock, and plan on other controls doing the finer identification work once a connection is open.
Match the Rule to the Port and the Direction
Web traffic normally means inbound connections to port 80 for plain HTTP and port 443 for HTTPS, and an allow list for those ports answers one narrow question: which source ranges may open a connection to this service. Decide first where the rule lives. A cloud security group, a host firewall, a load balancer listener and the web server itself can each filter sources, and stacking the same list in several places multiplies the upkeep. Pick the layer closest to the public edge that you can still automate, and let inner layers rely on it. Direction matters just as much. Rules that protect an origin server restrict inbound traffic to the ranges of the CDN or load balancer in front of it, while outbound rules govern which external ranges your own systems may call, a separate concern with separate lists. Keep the two rule sets visibly separate in your configuration, with names that say which is which, so nobody edits the wrong one during an incident. Also decide what happens to port 80. Many sites keep it open only from the same trusted ranges so redirects to HTTPS still work, instead of exposing a second, forgotten entry point to the entire internet.
Use Only the Ranges Your Provider Publishes
When a CDN, cloud platform or hosting provider sends traffic to your origin, it does so from ranges the provider itself publishes, and those official lists are the only safe source for an allow list. Major CDN and cloud providers maintain public pages or machine-readable files listing their current IPv4 and IPv6 ranges, and some offer feeds designed for automation. Work from the provider you actually use, download the list in its structured form when one exists, and convert it into your firewall format without trimming entries that look unused, because the provider may route through any of them. Never copy ranges from an old tutorial, a screenshot or someone else’s configuration; ranges get reassigned, expanded and split, and a copied list can be wrong in both directions at once, blocking live traffic while still admitting networks the provider retired. Note the date and source of every list you apply, so that when something breaks you can tell at a glance whether a rule came from the current publication or from a stale copy saved months earlier. Store the downloaded list next to the rules it generated, so the two versions can always be compared line by line.
Plan for Updates, Logging and a Way Back In
An allow list is a living configuration, not a one-time task. Providers add and retire ranges as they grow their networks, and a list that was perfect at launch will slowly drift until it blocks legitimate traffic or admits ranges nobody uses anymore. Build the refresh into your routine: re-pull the published lists on a schedule, diff them against the live rules, and apply changes through the same tested process you use for any other infrastructure change. Log what the rules deny, and look at those logs after every update, because a sudden rise in denied connections from one provider range usually means the list changed before you did. Protect yourself against your own rules as well. Keep administrative access, such as SSH or a management console, on a completely separate path from the web allow list, so a bad update cannot lock you out of the machine you need to fix. Where your CDN supports it, pair the allow list with a stronger origin check, such as authenticated origin pulls or a private header only the CDN sends, so the range filter is one layer rather than the whole defence.
Which One Fits Your Situation
A Single Website Sitting Behind a CDN
Allow inbound traffic on ports 80 and 443 only from the CDN ranges your provider publishes, covering both the IPv4 and IPv6 lists, and deny direct connections to the origin address from everywhere else. This stops visitors from bypassing the CDN and its protections by guessing the origin. Add an authenticated origin pull or a private header check if the plan supports it, and re-pull the published ranges on a schedule so new CDN capacity never gets blocked by your own rule.
A Load Balancer in Front of Several Servers
Put the allow list on the load balancer, since it is the only component the internet can reach, and let the servers behind it accept web traffic only from the balancer itself. If a CDN sits in front of the balancer, the balancer list is the CDN ranges; if clients connect directly, the list is the office, partner or customer ranges that legitimately use the service. Keeping one list at one layer means updates happen once, in one place, instead of being chased across every server.
An Internal Tool That Only Your Offices Should Reach
Allow the fixed public ranges your offices connect from, and confirm those ranges with each office’s internet provider before writing the rule, because a range that changes without warning will lock staff out. Smaller, well-known ranges make this the easiest allow list to maintain, but it still needs an owner: when an office moves, changes provider or sends staff home to work, the list has to change with it. Keep a separate administrative path for the person who maintains the tool, and log denied attempts so genuine lockouts are visible quickly.
A Public Service That Partners Connect To
Give each partner the ranges they will send from, in writing, and build the allow list from those confirmed ranges rather than from traffic you happen to observe. Observed addresses can include temporary networks a partner used once and will never use again. Agree on a notice period for range changes on both sides, test new ranges alongside old ones before removing anything, and keep per-partner rules separate so that ending one integration means deleting one block of rules instead of untangling a shared list.
Common Mistakes
- Copying IP ranges from an old tutorial or another team’s configuration instead of the provider’s current published list.
- Allowing a CDN range and assuming every request from it must be yours, when the same ranges carry traffic for many other customers.
- Writing careful IPv4 rules and forgetting that the service also answers on IPv6 ranges.
- Applying the allow list to administrative access as well, then locking yourself out when the list goes wrong.
- Saving the rules once and never refreshing them, even though providers add and retire ranges over time.
Frequently Asked Questions
What is the difference between an IP address and an IP range?
An IP address identifies one network interface, while a range is a block of consecutive addresses described with CIDR notation. Firewalls and cloud security groups accept ranges because services such as CDNs send traffic from many addresses at once. Allowing a range means trusting every address inside the block, so the wider the block, the more senders you are trusting. Always check both the starting point and the width of a range before adding it to a rule.
Should port 80 stay open if the site only uses HTTPS?
Port 80 usually survives so that plain HTTP requests can be redirected to HTTPS rather than failing. If you keep it open, restrict it to the same source ranges you allow on port 443, so the redirect path is not a wider opening than the site itself. Some setups close port 80 entirely and let the CDN or load balancer handle redirects at the edge. Either approach works, as long as the decision is deliberate and the two ports follow the same policy.
How often do provider IP ranges change?
There is no fixed schedule. Providers add ranges as they expand capacity, retire them as networks are reorganised, and sometimes split blocks into smaller pieces. Changes can arrive weeks apart or months apart, which is why a calendar habit beats a memory: re-pull the official lists on a regular cycle, compare them with your live rules, and apply the differences. Providers that offer machine-readable feeds make this easy to automate, and automation is the reliable way to keep an allow list honest.
Does an allow list replace other security controls?
No. An allow list only limits which networks can open a connection; it does nothing about what an allowed sender does next. A CDN range, for example, carries traffic for many customers, so reaching your origin from that range proves very little on its own. Keep authentication, encrypted connections, patching and application-level checks in place, and where possible add a control that identifies the sender itself, such as authenticated origin pulls or mutual TLS between the CDN and your origin.