Access Control — block or allow by IP, country (Geo) and ASN
Access Control decides whether to allow or deny a request before it reaches the other security layers, based on:
- IP / CIDR (address range),
- Geo (country, using 2-letter ISO codes such as
VN,US), - ASN (network/provider, for example the ASN of a frequently abused hosting provider).
Use it when you only want to serve visitors from a few countries, need to block an attacking IP range or ASN, or want to whitelist your office IP range. Example: your service is only for visitors in Vietnam — set the default to deny and allow only VN.
Read carefully — allow opens everything. A matching allow rule (whether IP, Geo or ASN) lets the request go straight through, skipping the WAF, X-Vtoken and Token V2. So do not use allow for broad ranges (for example allow country = VN) if you still want the WAF to inspect visitors from VN. To "allow only VN" while keeping the WAF in the picture: set default action = deny + allow VN — but understand that visitors from VN are then fully trusted. If you need both geographic filtering and WAF inspection, consider using Firewall Rules (a geo condition + a block action for everything else) instead of allow here.
Before you start
- The domain has been added and points to VNIS.
How to configure
- Go to Domains → select a domain → Access Control tab.

- Turn on Enabled. Choose the Default action (
allowordeny) — this is what happens when no rule matches. - Add rules in the appropriate group: IP rules / Geo rules / ASN rules. For each rule, choose
allowordeny, set a priority, and optionally set match hostnames. - Click Save (the first time, the button reads Create) and wait a few seconds for it to sync. The Remove button deletes the domain's entire Access Control configuration — including the Token V2 settings in the same tab.
Configuration fields
| Field | Meaning | Values | Default | Notes |
|---|---|---|---|---|
| Enabled | Turns access control on | On/off | Off | Only turns IP/Geo/ASN rules on or off. Token V2 (in the same tab) is independent of this switch — turning off Enabled does not turn off Token V2 |
| Default action | What happens when no rule matches | allow / deny | allow | deny = deny by default; only requests matching an allow rule get through |
| Geo rules | Country rules | ≤50 rules | — | countries = uppercase 2-letter ISO codes (VN,US) |
| ASN rules | ASN rules | ≤50 rules | — | asns = ASN numbers (for example 13335) |
| IP rules | IP/CIDR rules | ≤200 rules | — | Valid cidrs |
| (each rule) action | Allow/deny | allow / deny | deny | See the allow warning at the top of this page |
| (each rule) priority | Priority | Integer | The UI suggests one (highest existing priority + 10); empty in the API = 0 | Lower numbers win; on a tie, deny wins over allow |
| (each rule) match hostnames | Which hostnames the rule applies to | ≤20, operators equals/contains/starts_with/ends_with/wildcard/regex | — | Empty = all hostnames of the domain |
Limit on allow ranges: an allow rule with a CIDR broader than /8 (IPv4) or /16 (IPv6) is rejected when saved (400) — including 0.0.0.0/0, 0.0.0.0/1, ::ffff:0.0.0.0/96. This prevents accidentally opening everything. (The same rule applies to the whitelists of Token V2, X-Vtoken, Bot Management, Rate Limit and Firewall.)
Configuration examples
Example 1 — Serve only visitors in Vietnam.
- Default action:
deny· Geo rule:allowcountries = [VN], priority10. - Result: visitors outside VN receive 403; visitors in VN get through (note: they are trusted and skip the WAF — see the top of this page).
- Check: connect through a VPN abroad → 403; from VN → 200.
Example 2 — Block an attacking IP range.
- IP rule:
denycidrs = [203.0.113.0/24], priority5. - Result: every IP in that range receives 403.
- Check:
curl --resolve ...from an IP in the range (or look forblock_reason=aclin the logs).
Example 3 — Block a frequently abused ASN (for example a hosting provider).
- ASN rule:
denyasns = [12345], priority20. - Result: requests from networks in ASN 12345 receive 403; the log records
block_reason=acl asn=12345. - Check: look in analytics/WAF logs for
aclentries with that ASN.
Want to block by path (for example only /admin)? Access Control applies per domain/hostname, not per path. To "block visitors outside VN from /admin", use Firewall Rules with the condition ip.geoip.country ≠ VN AND http.request.uri.path starts_with /admin → action block. (See the Firewall Rules article.)
Order of evaluation
- First-match by priority: lower numbers win; on a tie,
denywins overallow. Scan order: IP → Geo → ASN. - Access Control runs very early (before X-Vtoken, Token V2, Rate limit and WAF). A matching
allowrule skips all later layers (except those that already run before it). - If no rule matches, the Default action applies.
Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
Saving returns 400 when adding a broad allow range | CIDR broader than /8 (v4) or /16 (v6) | Narrow the range, or use deny for everything else instead of a broad allow |
Visitors from VN are still blocked by the WAF even with allow VN | allow VN actually skips the WAF — if requests are still blocked, another rule with a lower priority may be responsible | Check the priority order; look for a deny rule with a lower priority |
| ASN rule has no effect | Missing ASN data, or the client cannot be mapped to an ASN | Check the logs; make sure the request really comes from that ASN |
| You blocked yourself | default_action=deny without allowing the office IP | Add an allow IP rule for the office (remember the range limit) |
FAQ
- Which takes precedence,
allowordeny, when priorities are equal?denywins. - Is country blocking 100% accurate? It is based on GeoIP and has a small margin of error; VPNs and proxies can get around it.
- I want both geographic filtering and WAF inspection — how? Do not use
allow countryhere (it skips the WAF). Usedenyfor unwanted countries, or use Firewall Rules.