Skip to main content

Firewall Rules — custom firewall rules

Firewall Rules let you write your own rules to block, allow or log traffic based on request conditions, without touching WAF signatures. Each rule has multiple conditions (field + operator + value), organized into condition groups: AND within a group, OR between groups.

Use it to: block based on combinations of conditions that Access Control (IP/Geo/ASN only, per domain) cannot handle, for example "block traffic from outside Vietnam but only for /admin". Example: your /admin area is only for staff in Vietnam. Create a block rule for country ≠ VN AND path starts with /admin.

You (org_admin) can use this tab. Access is granted by organization WAF + domain scope, not by role.

Apart from Access Control allow rules, this is the only stage with actions (allow/bypass) that let a request skip the security stages that follow: not just the WAF (signatures, AI profile and request body inspection), but also IP reputation, Rate Limit, Bot Management, DDoS-L7 and login protection. Use them with care.

Before you start​

  • The domain has been added and points to VNIS.
  • WAF is enabled for the organization. Otherwise, creating, editing, enabling or bulk-toggling rules returns 403 "WAF is not enabled for this organization" (viewing, listing and deleting are not affected by this check). In the dashboard, if the organization does not have WAF, the tab shows no access permission.
  • WAF is enabled for the domain (in the WAF tab). Otherwise, the firewall-rules tab is locked and shows the prompt "Enable WAF for this domain (WAF tab) to use this feature" with a button that takes you to the WAF tab.
  • To use the JA4 field: enable WAF JA4 in the WAF tab (see the JA4 note below).

How to configure​

  1. Go to Domains → select a domain → firewall-rules tab. Go to Domains → select a domain → firewall-rules tab
  2. Click Add rule. Set a name, choose an action and set a priority.
  3. Add conditions: choose a Field and an Operator, and enter a Value. Use Add group to create an OR group.
  4. (Depending on the action) set the block status / block duration / redirect URL.
  5. Turn on the Firewall Rules master switch if it is not on yet, click Save and wait a few seconds for the change to sync.

Configuration fields​

FieldDescriptionValuesDefaultNotes
NameRule name≤255 characters, must not contain < >——
PriorityPriorityI32, 0–10000100Lower numbers run first
ActionAction when the rule matchesSee the table belowblockallow/bypass skip all later security stages (rate limit, bot, DDoS, WAF)
Condition_groupOR group of conditions0–150AND within a group, OR between groups. Splitting into groups turns AND into OR
ConditionsNumber of conditions1–64—At least 1 is required
(cond) fieldRequest attributeOne of the fields listed belowhttp_request_uri_pathUnknown field → 400
(cond) operatorMatch operatorOne of the operators listed belowstarts_withA meaningless (field, operator) pair → 400
(cond) valueValue to match≤4096 characters/Not needed with exists/not_exists/is_empty/is_not_empty
(cond) negateInverts the resultOn/offOff—
(cond) case_insensitiveIgnores upper/lower caseOn/offOnAffects eq/contains/matches and so on
(cond) transformationsTransforms the value before comparing≤8——
Status_codeStatus code for the block action400–599403Out of range → 400 ("must be a valid error status 400-599")
Block_status_codeStatus code for the timed_block actionOnly 403 or 429 (other values are rejected: "must be 403 or 429")403; the "timed block" template in the console prefills 429—
Block_duration_secondsBlock duration (timed_block)10–604800300Only used with timed_block. When triggered, it blocks the client IP across the whole domain for block_duration_seconds seconds, not just the path in the condition (see Configuration examples)
Redirect_url / redirect_codeRedirect target and codehttps://… or a same-origin path (/path; http:// and //… are not accepted), ≤2048 characters / 301·302·307·308302Only used with redirect

Actions — which ones you can use:

ActionStatus
block, allow, log, bypass, redirect, timed_blockAvailable
managed_challenge (the "JS Challenge (Managed)" tile; the names challenge / js_challenge map to the same action)Available: a per-rule JavaScript challenge. JS Challenge must be enabled for your account by VNETWORK (see Action: JS Challenge (Managed))
rate_limit, rewrite, wait_pageReserved, not available: creating or editing a rule with these actions is rejected with 400. The console only shows them in a "Reserved" row and you cannot select them. Existing rules with these actions have no effect

allow and bypass behave identically: both skip the later security stages (IP reputation, Rate Limit, Bot Management, DDoS-L7 and the WAF, including request body inspection) and are terminal actions. There is no difference in authentication: token auth (X-Vtoken / Token V2) still runs for both. IPs can be spoofed: http_x_forwarded_for matches the raw XFF header sent by the client (which can be spoofed), while ip_src is the real connection IP (which cannot be spoofed). For any allow/deny decision based on IP, use ip_src.

Available fields (dropdown): ip_src, ip_geoip_country, ip_geoip_asnum, ip_geoip_asn_org, http_request_method, http_request_uri, http_request_uri_path, http_request_uri_query, http_request_full_uri, http_host, http_user_agent, http_referer, http_content_type, http_origin, http_via, http_accept_language, http_authorization, http_content_length, http_x_forwarded_for, tls_version, ssl, http_request_headers/http_cookie/http_request_args (require a key name)… Operators (text fields): eq, ne, contains, not_contains, starts_with, ends_with, matches (regex), not_matches, in, not_in, wildcard, exists, not_exists, is_empty, is_not_empty. IP fields use ip_in/ip_not_in. Validation errors → 400.

The ja4 field is in the dropdown (labeled "JA4 TLS Fingerprint (needs JA4 enabled)"), but it only matches when the domain has WAF JA4 turned on. If it is off, ja4 rules never fire. The dropdown also includes threat_score, behind_trusted_cdn, http_request_version, http_request_args_names and http_request_headers_names. The Test button is only a simplified simulator and may not reflect every condition (it shows a "Not fully simulated" warning when that applies). Always verify with curl against your live domain. Limit: at most 200 rules per domain. Going over returns 409.

Configuration examples​

Example 1 — Block access to /admin from outside Vietnam (geo + path).

  • 1 group (AND): condition 1 ip_geoip_country ne VN; condition 2 http_request_uri_path starts_with /admin.
  • Action block, status 403, priority 10.
  • Result: requests to /admin from outside Vietnam → 403; requests from Vietnam or to other paths pass.
  • How to verify: curl -I https://example.com/admin through a VPN outside Vietnam → 403; from Vietnam → no 403.

Example 2 — Block a scraping user agent.

  • Condition: http_user_agent contains python-requests.
  • Action block, status 403.
  • Result: requests with that UA get a 403.
  • How to verify: curl -A python-requests https://example.com/ → 403.

Example 3 — Temporarily penalize IPs abusing /login (timed_block).

  • Group (AND): http_request_uri_path starts_with /login AND ip_src ip_in 203.0.113.0/24.
  • Action timed_block, block_duration_seconds 600.
  • Result: when an IP in the range hits /login, the rule triggers and blocks that IP across the whole domain for 10 minutes. From then on, every path from that IP is blocked, not just /login. The path and ip_src conditions only decide when the block starts.
  • How to verify: call /login from an IP in the range → blocked; try another path from the same IP → also blocked; access returns only after 600s.

OR groups: to "block UA A or UA B", put each condition in a different condition_group.

Action: JS Challenge (Managed)​

The "JS Challenge (Managed)" action returns a JavaScript challenge page to browsers that match the rule instead of hard-blocking them. A browser that passes receives a clearance ticket and gets through this rule until the ticket expires. How it works: JS Challenge.

  • The rule is what turns the challenge on. There is no per-domain switch. Default values (display, delay, TTL, bypass) come from the "JS Challenge defaults" card in the Bot Challenge tab.
  • JS Challenge must be enabled for your account by VNETWORK; contact support. Until it is enabled, the JS Challenge tile is locked. Existing challenge rules can still be edited, disabled or deleted, but they are inert (they have no effect until JS Challenge is enabled).

Steps:

  1. Add rule → select the JS Challenge (Managed) tile.
  2. Adjust the rule's knobs: Create Firewall Rule form with the JS Challenge (Managed) action: JS Challenge display (this rule) Domain default/Interstitial/Transparent, Redirect delay (seconds), Clearance TTL (minutes), &quot;When the visitor cannot run JS&quot; = Block (403) — default, with a list of affected clients
  3. Add conditions that narrow the scope (exactly the HTML paths you want to protect; adding http_request_method eq GET is recommended), then click Create rule.
  4. The rule list shows a summary of the challenge rule's knobs (for example Interstitial · TTL 15 min · no-JS: block) and an inert badge when JS Challenge is not enabled for your account. Firewall Rules list: the JS Challenge rule shows the summary &quot;Interstitial · TTL 15 min · no-JS: block&quot; and an &quot;inert&quot; badge when JS Challenge is not enabled
KnobDescriptionValuesDefault
JS Challenge display (this rule)Display styleDomain default / Interstitial / TransparentDomain default
Redirect delay (seconds)How long the waiting page is held (Interstitial only)0–10 seconds; empty = domain defaultDomain default
Clearance TTL (minutes)How long the clearance ticket is valid for this ruleEmpty = inherit, or 1–1440 minutesInherit (30 minutes)
When the visitor cannot run JSHow to handle requests that match the rule, cannot be challenged and have no clearance ticketBlock (403) — default / Allow (pass to origin)Block

Who does the Block fallback affect? Clients that cannot run the JavaScript challenge, such as native mobile apps, video players, API and cross-origin calls, and callbacks from payment gateways, get a 403 on paths the rule matches. Exclude those paths from the rule conditions, or choose the Allow fallback. The system rejects (422) a Block fallback on a rule that matches every request (no conditions, path /, regex .*, a CIDR covering everything, and so on). To measure first, create a rule with the same conditions and the Log action.

Order of evaluation​

  • Blocking actions (block/timed_block/redirect/log/challenge) run after Rate Limit and before the WAF signatures. allow/bypass rules are evaluated earlier (right after X-Vtoken/Token V2, before IP reputation and Rate Limit). For that reason, allow/bypass rules should be based on identity (IP, geo, ASN, host, path, header), not on threat_score (the score has not been calculated yet at that point).
  • Among rules: lower priority numbers run first, and evaluation stops at the first matching rule.
  • allow/bypass skip all later security stages (Rate Limit, Bot, DDoS, WAF), but vtoken and token_v2 still apply (a firewall allow does not bypass those two).
  • Access Control allow runs earlier and skips both Firewall Rules and the WAF.

Troubleshooting​

SymptomCauseFix
Creating or editing a rule returns 403WAF is not enabled for the organizationContact support to enable WAF for the organization
Saving returns 400Unknown field/operator, a meaningless (field, operator) pair, a value over 4096 characters, or an invalid regex/CIDRChoose the correct field/operator; check the value
Adding a rule returns 409The limit of 200 rules per domain has been reachedMerge or delete some rules
block_status_code is rejected on save (timed_block)A code other than 403/429 was enteredUse only 403 or 429 (the block action uses status_code 400–599)
A ja4 rule does not fireWAF JA4 is not onEnable WAF JA4 in the WAF tab
Saving a rate_limit/rewrite/wait_page rule returns 400These actions are reserved and not availableUse block/timed_block/log/redirect/managed_challenge
The firewall-rules tab is lockedWAF is not enabled for the domainGo to the WAF tab and enable WAF for the domain
The JS Challenge (Managed) tile is locked / a challenge rule has an inert badgeJS Challenge is not enabled for your accountContact support; use the log action to measure in the meantime
Saving a JS Challenge rule returns 422Block fallback on a rule that matches every requestNarrow the conditions or choose Allow (pass to origin)
Mobile apps or video players get 403 after adding a JS Challenge ruleThe Block fallback applies to clients that cannot run JSExclude API/media paths from the conditions or change the fallback to Allow

FAQ​

  • How are Firewall Rules different from Access Control? Access Control only handles IP/Geo/ASN and applies per domain. Firewall Rules match multiple conditions (path, UA, header, method and so on) with AND/OR combinations, so they can block by path.
  • Does allow here skip the WAF? Yes (along with Rate Limit/Bot/DDoS), but it does not skip vtoken/token_v2. allow and bypass behave identically.
  • Can I test with the Test button? Only as a reference. It is a simplified simulator; verify for real with curl.
  • Which status codes can a block return? The block action: status_code 400–599, default 403. The timed_block action: block_status_code only 403 or 429 (other codes are rejected); the default is 403 (the "timed block" template in the console prefills 429).