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
- Go to Domains → select a domain → firewall-rules tab.

- Click Add rule. Set a name, choose an action and set a priority.
- Add conditions: choose a Field and an Operator, and enter a Value. Use Add group to create an OR group.
- (Depending on the action) set the block status / block duration / redirect URL.
- 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
| Field | Description | Values | Default | Notes |
|---|---|---|---|---|
| Name | Rule name | ≤255 characters, must not contain < > | — | — |
| Priority | Priority | I32, 0–10000 | 100 | Lower numbers run first |
| Action | Action when the rule matches | See the table below | block | allow/bypass skip all later security stages (rate limit, bot, DDoS, WAF) |
| Condition_group | OR group of conditions | 0–15 | 0 | AND within a group, OR between groups. Splitting into groups turns AND into OR |
| Conditions | Number of conditions | 1–64 | — | At least 1 is required |
| (cond) field | Request attribute | One of the fields listed below | http_request_uri_path | Unknown field → 400 |
| (cond) operator | Match operator | One of the operators listed below | starts_with | A meaningless (field, operator) pair → 400 |
| (cond) value | Value to match | ≤4096 characters | / | Not needed with exists/not_exists/is_empty/is_not_empty |
| (cond) negate | Inverts the result | On/off | Off | — |
| (cond) case_insensitive | Ignores upper/lower case | On/off | On | Affects eq/contains/matches and so on |
| (cond) transformations | Transforms the value before comparing | ≤8 | — | — |
| Status_code | Status code for the block action | 400–599 | 403 | Out of range → 400 ("must be a valid error status 400-599") |
| Block_status_code | Status code for the timed_block action | Only 403 or 429 (other values are rejected: "must be 403 or 429") | 403; the "timed block" template in the console prefills 429 | — |
| Block_duration_seconds | Block duration (timed_block) | 10–604800 | 300 | Only 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_code | Redirect target and code | https://… or a same-origin path (/path; http:// and //… are not accepted), ≤2048 characters / 301·302·307·308 | 302 | Only used with redirect |
Actions — which ones you can use:
| Action | Status |
|---|---|
block, allow, log, bypass, redirect, timed_block | Available |
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_page | Reserved, 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_countryneVN; condition 2http_request_uri_pathstarts_with/admin. - Action
block, status403, priority10. - Result: requests to
/adminfrom outside Vietnam → 403; requests from Vietnam or to other paths pass. - How to verify:
curl -I https://example.com/adminthrough a VPN outside Vietnam →403; from Vietnam → no 403.
Example 2 — Block a scraping user agent.
- Condition:
http_user_agentcontainspython-requests. - Action
block, status403. - 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_pathstarts_with/loginANDip_srcip_in203.0.113.0/24. - Action
timed_block,block_duration_seconds600. - 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 andip_srcconditions only decide when the block starts. - How to verify: call
/loginfrom 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:
- Add rule → select the JS Challenge (Managed) tile.
- Adjust the rule's knobs:

- Add conditions that narrow the scope (exactly the HTML paths you want to protect; adding
http_request_method eq GETis recommended), then click Create rule. - 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.
| Knob | Description | Values | Default |
|---|---|---|---|
| JS Challenge display (this rule) | Display style | Domain default / Interstitial / Transparent | Domain default |
| Redirect delay (seconds) | How long the waiting page is held (Interstitial only) | 0–10 seconds; empty = domain default | Domain default |
| Clearance TTL (minutes) | How long the clearance ticket is valid for this rule | Empty = inherit, or 1–1440 minutes | Inherit (30 minutes) |
| When the visitor cannot run JS | How to handle requests that match the rule, cannot be challenged and have no clearance ticket | Block (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/bypassrules 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 onthreat_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/bypassskip 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
allowruns earlier and skips both Firewall Rules and the WAF.
Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
| Creating or editing a rule returns 403 | WAF is not enabled for the organization | Contact support to enable WAF for the organization |
| Saving returns 400 | Unknown field/operator, a meaningless (field, operator) pair, a value over 4096 characters, or an invalid regex/CIDR | Choose the correct field/operator; check the value |
| Adding a rule returns 409 | The limit of 200 rules per domain has been reached | Merge or delete some rules |
block_status_code is rejected on save (timed_block) | A code other than 403/429 was entered | Use only 403 or 429 (the block action uses status_code 400–599) |
A ja4 rule does not fire | WAF JA4 is not on | Enable WAF JA4 in the WAF tab |
Saving a rate_limit/rewrite/wait_page rule returns 400 | These actions are reserved and not available | Use block/timed_block/log/redirect/managed_challenge |
| The firewall-rules tab is locked | WAF is not enabled for the domain | Go to the WAF tab and enable WAF for the domain |
| The JS Challenge (Managed) tile is locked / a challenge rule has an inert badge | JS Challenge is not enabled for your account | Contact support; use the log action to measure in the meantime |
| Saving a JS Challenge rule returns 422 | Block fallback on a rule that matches every request | Narrow the conditions or choose Allow (pass to origin) |
| Mobile apps or video players get 403 after adding a JS Challenge rule | The Block fallback applies to clients that cannot run JS | Exclude 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
allowhere skip the WAF? Yes (along with Rate Limit/Bot/DDoS), but it does not skip vtoken/token_v2.allowandbypassbehave 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
blockaction:status_code400–599, default 403. Thetimed_blockaction:block_status_codeonly 403 or 429 (other codes are rejected); the default is 403 (the "timed block" template in the console prefills 429).