Browse apps

Guides

How to Block IP Addresses and CIDR Subnets on Shopify

TL;DR

Because Shopify hosts your storefront on a managed CDN without .htaccess access, blocking IP addresses works through a theme app embed that evaluates visitor IPs against exact IPv4/IPv6 rules, leading-octet prefixes, inclusive ranges, or CIDR subnets. Pair storefront IP blocking with datacenter ASN filtering and server-side Checkout Protection to stop attackers who rotate IPs or disable JavaScript.

When you need to block an IP address on Shopify, the trigger is usually concrete: a repeat fraudster submitting orders from the same connection, a competitor’s office network checking your inventory and pricing every morning, or an automated scraper hammering your product pages from a cluster of cloud servers. On a self-hosted store, you would drop the offending IP or subnet in Nginx, Apache .htaccess, or a custom reverse proxy.

Because Shopify hosts your storefront on its managed global CDN, merchants cannot edit edge web server rules directly. And while Shopify’s native Fraud Analysis records the IP address of the computer used to place an order, it only surfaces that information after the order has already gone through checkout.

To stop unwanted connections before they browse your catalog—and prevent determined bad actors from pushing orders through—you need storefront IP filtering paired with server-side checkout rules. In this guide, we explain how IPv4 and IPv6 matching, prefixes, inclusive ranges, and CIDR subnets work in LabX Fraud Filter, how to bulk-import up to 2,000 IP rules via CSV, and where you should reinforce IP rules with datacenter ASN filtering and Checkout Protection. For a complete overview of visitor filtering across all rule types, see our Shopify traffic and bot blocking guide.

Where do you find the IP addresses you need to block on Shopify?

Before creating an IP or subnet rule, you need the exact IPv4 or IPv6 address—or the network block—behind the unwanted activity. On Shopify, merchants typically gather offending IPs from three places:

  1. Shopify Order Fraud Analysis and timeline: Open any suspicious order in your Shopify admin and check the Fraud analysis card or the Conversion summary. Shopify logs the IP address that submitted the checkout alongside geolocation and proxy indicators. If you see multiple chargeback orders or rapid card testing attacks originating from the same IP or /24 subnet, copy that address directly.
  2. The LabX Fraud Filter Visitor log: Inside LabX Fraud Filter, open Visitor in the app navigation (documented in our Analytics and Visitor log guide). The Visitor log displays the 50 most recent blocked or redirected visits, including the timestamp, visitor IP, two-letter Country code, Action, matching Reason, Device and browser, and the requested storefront Path.
  3. Ad-click fraud and server log monitors: If you run third-party click-fraud protection on paid search campaigns or track external webhook hits, those tools often export CSV lists of abusive IPs and scraper subnets that you can import directly into your storefront blocklist.

How do exact IPs, prefixes, IP ranges, and CIDR subnets compare?

Blocking a single IP address (203.0.113.7) works when you are dealing with a static home or office connection. However, scraper operators and cloud-hosted bots rarely stick to a single IP—they rotate across contiguous blocks of addresses leased from the same network provider.

Instead of creating hundreds of individual rules, LabX Fraud Filter supports four IP matching formats across both IPv4 (32-bit addresses written in dotted-quad decimal) and IPv6 (128-bit addresses written in colon-separated hexadecimal groups):

IP Match TypeSyntax Examples (IPv4 & IPv6)How LabX Evaluates ItBest Merchant Use Case
Exact IP Address203.0.113.7, 177.229.213.89, 2001:db8::1Parses the visitor and target into 32-bit (IPv4) or 128-bit (IPv6) integers for exact equalityBlocking a specific repeat abuser, competitor office static IP, or known proxy exit node
IP Start With (Prefix)177.229., 192.168.1.*, 2002:db8:Matches the leading 1–3 IPv4 octets (ending on . or *) or 1–7 IPv6 hex groups (ending on :) on a segment boundaryQuickly blocking an /8, /16, or /24 octet boundary without calculating CIDR masks
Inclusive IP Range192.0.2.1-192.0.2.255, 10.0.0.1-10.0.0.9Converts start, end, and visitor IPs of the same version into BigInt values and checks start <= ip <= endBlocking an arbitrary sub-allocation from a WHOIS record that does not align with a single CIDR boundary
CIDR Subnet198.51.100.0/24, 177.229.213.89/24, 2001:db8::/32Uses bitwise right-shift (address >> (bits - prefix)) per IETF RFC 4632 across /0–/32 (IPv4) or /0–/128 (IPv6)Blocking an entire allocated network subnet (e.g., 256 IPv4 addresses in a /24 or 65,536 in a /16) in one rule

How CIDR notation saves rule space

Under Classless Inter-domain Routing (RFC 4632), the number after the slash (/prefix) specifies how many leading bits of the address are fixed as the network prefix:

  • IPv4 /24 subnet (e.g., 203.0.113.0/24): Fixes the first 24 bits (the first three octets) and matches all 256 IPv4 addresses from 203.0.113.0 through 203.0.113.255.
  • IPv4 /16 subnet (e.g., 198.51.0.0/16): Fixes the first 16 bits (the first two octets) and matches 65,536 contiguous IPv4 addresses.
  • IPv6 /48 or /32 prefix (e.g., 2001:db8::/32): Because IPv6 addresses are 128 bits long, operating systems regularly rotate the lower 64 bits (privacy extensions) for the same device. Blocking a single /128 IPv6 address is rarely effective; matching a /64 (single subnet) or /48 (site allocation) is required to cover an IPv6 network.

How do you set up IP, range, and CIDR rules in LabX Fraud Filter?

You can add individual IP rules, group comma-separated subnets under a single rule, or bulk-import a spreadsheet of up to 2,000 lines. Follow along with screenshots in our IP address and location rules documentation.

Before saving any IP or subnet block—especially wide prefixes or /16 CIDR ranges—open Settings > General settings in LabX Fraud Filter and copy your Admin access link (https://your-store.myshopify.com/?fg_bypass=...). Open that link once in your browser so our server verifies your token and your browser skips every storefront rule while you test. If the link is ever shared accidentally, click Generate new link to invalidate the previous token immediately.

Step 2: Select Block or Redirect and open IP Address rules

Go to Blocking Rules in the app navigation. Choose whether your rule should Block matching visitors (displaying your customizable block screen) or Redirect them to a specific external URL (every redirect rule carries its own destination URL). You can also create Allow (whitelist) rules so trusted partner or warehouse IPs bypass subsequent country or bot blocks. Click the IP Address card.

Step 3: Choose your match type and enter IPs or upload a CSV

In the Settings card of the IP Address rule builder:

  1. Pick the radio button for your match format:
    • Select IP Address for exact IPv4 or IPv6 addresses (203.0.113.7).
    • Select IP Start With for leading prefixes (192.168.1.* or 177.229.).
    • Select IP Range, then use the Select IP range type dropdown to choose Range (192.168.1.1-192.168.1.255) or CIDR (177.229.213.89/24, 2002:db8::/32).
  2. Enter multiple values or upload a CSV (Select type):
    • Manual mode: Paste one or multiple IP addresses, ranges, or CIDR subnets separated by commas or newlines (up to 20,000 characters combined in a single rule). Grouping related subnets into one comma-separated rule lets them share a single status toggle, action, and note without cluttering your rule table.
    • Upload CSV mode: Switch Select type to Upload CSV to import a .csv file up to 2 MB or 2,000 lines at a time (up to the store limit of 500 rule rows). The importer automatically ignores a header row (value, ip, or address) and any extra spreadsheet columns, validates every row independently, reports exact line numbers for any malformed entries, and skips duplicates.
  3. Add an internal team note: Enter a note (up to 500 characters) or click a quick-reason chip—+ Known VPN / Proxy exit IP, + Repeated card testing attempts, + Suspicious bulk order attempt, or + Blacklisted scraper / bot IP—and click Save. Later, you can search across rule values, types, and notes on the Blocking Rules table and bulk-enable, disable, or delete rows in one click.

What are the honest technical limits of storefront IP blocking on Shopify?

We believe merchants deserve plain technical facts about how storefront apps work on Shopify and what an IP block can and cannot stop.

1. Storefront IP rules run in the visitor’s browser

Because Shopify serves storefront HTML from its CDN before any app script runs, storefront rules in LabX Fraud Filter execute inside the visitor’s browser via the Fraud Guard theme app embed:

  • Your ruleset travels inside a Shopify metaobject: To avoid slowing down non-location pages, your compiled ruleset is stored in a Shopify metaobject (app_config) rendered directly in the page HTML. Because rules are evaluated client-side, the rule values are visible to anyone who inspects the page source (admin notes are stripped when compiling the storefront payload, but you should still never put confidential information in a rule note).
  • One cached lookup per session: On the first page load of a session, the embed makes a single signed request via the Shopify App Proxy to identify the visitor’s IP, country, region, ISP/ASN, and Tor/datacenter status, then caches that result in sessionStorage for 30 minutes. If our server is unreachable, the guard fails open and lets the visitor through so an outage never locks real buyers out of your store.
  • Disabling JavaScript or calling APIs directly bypasses storefront blocks: A technical user or custom script that turns off JavaScript, fetches pages with curl, or posts directly to Shopify’s Cart and Checkout APIs will bypass any browser-based blocker. No Shopify app can intercept raw HTTP connections at the CDN edge before the page reaches the browser.
  • Content protection is a casual deterrent, not DRM: If you also enable right-click, keyboard shortcut, or text-selection blocking in Settings > Protection, remember that those controls only deter casual copying by shoppers—they cannot stop OS screenshot shortcuts, curl, or DevTools.

2. Why you should pair IP rules with Datacenter blocking and Checkout Protection

When an automated scraper or carding bot attacks your store, manually blocking individual IP addresses quickly becomes a game of whack-a-mole as the attacker spins up new cloud instances. Furthermore, if a human fraudster switches to a consumer VPN or mobile hotspot—or disables JavaScript—an IP rule alone will not stop their order.

To close both gaps, combine targeted IP/CIDR rules with automated network filtering and server-side Shopify fraud prevention at checkout:

Merchant ThreatWhy Manual IP Rules Alone Fall ShortComplete Defense in LabX Fraud Filter
Competitor office or static abuser IPWorks well for fixed IPs, but fails if they switch to another subnet in the same blockBlock the exact IP or /24 CIDR subnet in Blocking Rules > IP Address
Cloud-hosted catalog scrapers & botsScrapers rotate across thousands of AWS, DigitalOcean, or Hetzner IPsEnable Block datacenter traffic, Block Tor traffic, and Auto-block unknown bots in Settings > Mitigator, or block the provider’s ASN in Blocking Rules > ISP (see our datacenter vs VPN blocking guide)
Fraudster disabling JavaScript or rotating VPN IPs at checkoutBrowser scripts do not run when JS is off, and Shopify Checkout Validation Functions inspect cart/checkout form data rather than raw IP headersAdd server-side Checkout Protection rules (which run on Shopify’s servers and cannot be bypassed) blocking the buyer’s Email, Phone, Name, Address, Zip, Country, or Customer tag (see our Checkout Validation Function guide)
Orders from unserviceable countriesMaintaining manual IP ranges for entire countries is impractical and error-pronePair a storefront Location rule with a server-side Checkout Protection Country rule (see our guide to blocking countries on Shopify)

Note that Block datacenter traffic specifically targets cloud hosting and server providers where automated bots run—it is not consumer VPN blocking, so real customers using a privacy VPN on a consumer network are not needlessly locked out.

How do you protect Googlebot and SEO when blocking IP subnets?

A major risk of pasting broad IP prefixes (66.249.*) or large CIDR blocks into a naive firewall script is accidentally blocking search engine crawlers. As Google Search Central explains, Googlebot crawls from large pools of datacenter IP addresses—primarily in the United States—and blocking those subnets can cause your product pages to be de-indexed.

LabX Fraud Filter prevents accidental crawler blocks through its strict evaluation order of precedence:

  1. Verified Admin bypass token (?fg_bypass=...)
  2. Allowed verified good bots (25 built-in search, social, AI, and SEO crawlers, including Googlebot, Bingbot, Applebot, Facebookbot, AhrefsBot, SemrushBot, GPTBot, and ClaudeBot)
  3. Explicit Allow (whitelist) rules
  4. Auto-block unknown bots toggle
  5. Tor exit node and Datacenter traffic switches
  6. Suspicious crawler checks (unknown user-agent and headless browser hints)
  7. Country Block-all-except mode
  8. Redirect rules
  9. Block rules (including your IP, CIDR, ISP, and country blacklists)
  10. Allow by default

Because the Allowed verified good bots check runs at step 2—long before your IP and CIDR block rules at step 9—search engines and social link-preview crawlers can index your store normally as long as you keep Allow verified good bots enabled in Settings > Mitigator. Ready to set up your first IP, CIDR, and checkout rules? Explore LabX Fraud Filter or browse our Checkout Protection user guide.

Frequently asked questions

Can I block an IP address natively in the Shopify admin without an app?

No. Shopify hosts storefronts on a managed global CDN and does not expose server configuration files like .htaccess or Nginx blocklists. While Shopify Fraud Analysis shows the IP address used to place an order after checkout, blocking or redirecting an IP address on your storefront requires a theme app embed such as LabX Fraud Filter.

What is the difference between blocking a single IP, an IP range, and a CIDR subnet?

A single IP rule blocks one exact IPv4 or IPv6 address (such as 203.0.113.7). An inclusive IP range blocks every address between a start and end IP (such as 192.0.2.1-192.0.2.255). A CIDR subnet uses a network prefix length (such as 198.51.100.0/24 or 2001:db8::/32) to block an entire contiguous block of IPv4 or IPv6 addresses allocated to a network.

Can a bot or fraudster bypass storefront IP blocking on Shopify?

Yes. Storefront IP rules run in the visitor browser through the Fraud Guard theme app embed. If an attacker disables JavaScript, fetches HTML with curl, or sends requests directly to the Cart and Checkout APIs, browser rules do not execute. Pairing storefront IP rules with server-side Checkout Protection closes that gap at checkout because Shopify Cart and Checkout Validation Functions run on Shopify servers and cannot be bypassed.

Will blocking IP ranges or CIDR blocks accidentally block Googlebot?

Not when "Allow verified good bots" stays enabled. LabX Fraud Filter evaluates its built-in allowlist of 25 search engine, social, AI, and SEO crawlers at the top of the precedence order before checking your IP, CIDR, datacenter, or country block rules.

Sources

  1. IETF RFC 4632 — Classless Inter-domain Routing (CIDR): The Internet Address Assignment and Aggregation Plan
  2. Shopify Dev Docs — About Cart and Checkout Validation Functions
  3. Shopify Help Center — Fraud Analysis
  4. Google Search Central — Verifying Googlebot and Other Google Crawlers

Part of our guide: Traffic & bot blocking →

Put your first blocking rule live in minutes

Install LabX Fraud Filter free on Shopify, turn on the Fraud Guard embed and add your rules.

Install free on Shopify

Free plan available