Skip to main content

WAF — Web Application Firewall

The WAF (Web Application Firewall) blocks application-layer attack requests such as SQL injection, XSS, path traversal and vulnerability probing. It uses a managed ruleset (built in) plus Custom Rules that you write yourself.

Use it to: protect your website or app from automated attacks and vulnerability exploits. Example: your site is constantly scanned with ?id=1 OR 1=1 and /wp-login.php. Enable the WAF so these attack patterns are blocked with a 403 at the edge.

VNIS evaluates requests in several stages, in this order: threat score check → your Firewall Rules → managed rules → platform rules → your domain's Custom Rules → AI profile.

The WAF only works when WAF is enabled for your organization and the organization has not used up its WAF quota. Otherwise, enabling or editing the WAF for a domain returns 403 "WAF is not enabled for this organization". This quota is assigned by VNETWORK. If you need more, contact support.

In the console: if WAF is not enabled for the organization, the WAF and security menus and tabs show a no permission message. If the organization has WAF but the domain has not enabled WAF, the security tabs (Firewall, Bot, Rate Limiting, Traffic Shield, ATS and so on) are locked and show a Go to the WAF tab to enable button. The WAF tab stays available so you can enable it.

Before you start​

  • The domain has been added and points to VNIS.
  • WAF is enabled for the organization and there is WAF quota left (otherwise you get a 403).
  • To use the JA4 field in rules, enable WAF JA4 in the WAF tab itself.

How to configure​

  1. Go to Domains → select a domain → waf tab (sub-tabs: Overview · WAF Rules · Protection · Custom Rules · Events). Go to Domains → select a domain → waf tab (sub-tabs: Overview · WAF Rules ·
  2. Turn on Enabled. Choose a mode: block (block requests) or detect (log only, do not block).
  3. In WAF Rules: keep Managed rules on. If a managed rule causes false positives, add it to Disabled managed rules or use Path exceptions.
  4. In Protection: set Threat threshold, DLP, GraphQL and Block oversized body as needed.
  5. In Custom Rules: add WAF expression rules specific to this domain (see Example: Custom Rules). Use the Test expression button to check the syntax before saving.
  6. Click Save and wait a few seconds for the change to sync.

Configuration fields​

FieldDescriptionValuesDefaultNotes
EnabledEnables the WAF for the domainOn/offOffRequires organization WAF and remaining WAF quota (otherwise 403)
ModeBlock or detect onlyblock / detectblockdetect = log only, does not block. Applies to managed rules, platform rules and Custom Rules; the AI profile has its own mode (see the note below)
Managed rules enabledEnables the built-in rulesetOn/offOnKeep this on
Disabled managed rulesDisables individual managed rules (by ID)≤5000 entries—Use when a single rule causes false positives
Path exceptionsExempts certain paths from the WAF≤1000 entries—Keep the scope narrow; avoid exempting the whole site
WAF JA4Makes the JA4 TLS fingerprint available to rulesOn/offOffCannot be turned off while Rate Limit uses by_ja4 (→ 409)
AI profileAttaches an AI scoring profileProfile ID—See the WAF AI Profiles page
Threat thresholdThreat score threshold for blocking0 = use the default of 800Lower = more sensitive (more false positives)
DLP modePrevents sensitive data leaking in responsesAs shown in the console——
GraphQL max depthLimits GraphQL query depth0 = use the default of 100—
Block oversized bodyHow to handle bodies that are too largeauto / always / neverauto—

detect does not downgrade every stage: switching Mode to detect only puts managed rules, platform rules and Custom Rules into log-only mode. The AI profile has its own mode setting and does not follow the WAF detect setting. An AI rule in block mode still returns 403 even when the WAF is set to detect. In addition, Firewall Rules, IP reputation, Access Control and Bot Management keep blocking regardless of the WAF Mode. As a result, a request can still get a 403 after you switch to detect.

Tip: to find out which stage blocked a request, check the block reason of the request in the Events tab.

Custom Rules (the domain's WAF expression rules):

FieldDescriptionValuesNotes
rule_idRule identifier≤64 characters, alphanumeric plus - _ .—
expressionWAF expressionRequired, must compileInvalid syntax → 400 "invalid wirefilter expression"
actionAction when the rule matchesblock / log / allowallow = skip the remaining signature stages; it cannot override a block from managed rules (see Order of evaluation)
block_statusStatus code returned on block100–599—
priorityPriority−1000..1000—

Fields available in expressions (WAF expression syntax): http.host, http.method, http.uri.path, http.uri.query, http.user_agent, http.referer, http.content_type, http.cookie, http.x_forwarded_for, http.x_real_ip, http.x_api_version, http.authorization, ip.src, ssl, http.request_length, http.geo.country, http.geo.asn, http.ja4. WAF validation errors return 400.

Example: Custom Rules​

For each example, write the expression and click Test expression to check the syntax. Valid syntax returns {valid:true}. Invalid syntax still returns HTTP 200 but with {valid:false, error:...}. Expressions larger than 4096 bytes return 400. Then save the rule and test it with curl.

Example 1 — Block access to /admin from outside Vietnam.

  • expression: http.uri.path starts_with "/admin" && http.geo.country ne "VN"
  • action: block · block_status: 403.
  • Result: requests to /admin from other countries → 403; requests from Vietnam pass.
  • How to verify: curl -I https://example.com/admin through a VPN outside Vietnam → 403; from Vietnam → no 403.

Example 2 — Block an ASN that often scans for vulnerabilities.

  • expression: http.geo.asn eq 12345
  • action: block · block_status: 403.
  • Result: requests from networks in ASN 12345 are blocked.
  • How to verify: check Events for an entry matching the rule, or curl from an IP in that ASN → 403.

The ASN here is a number: the expression field http.geo.asn matches the ASN number (for example http.geo.asn eq 64500), not the network operator's name. To match by organization name (for example, containing "Example Telecom"), use Firewall Rules with the ip_geoip_asn_org field ("ASN Organisation"). Do not enter an ASN number in the organization name field, and do not enter a name in http.geo.asn.

Example 3 — Log (without blocking) suspicious user agents to observe them first.

  • expression: http.user_agent contains "sqlmap"
  • action: log (or set Mode = detect for the whole WAF while testing).
  • Result: requests with the sqlmap UA are logged but not blocked. You observe them first, then switch to block.
  • How to verify: curl -A sqlmap https://example.com/ and then check the Events tab.

Order of evaluation​

  • Stage order: threat score check → Firewall Rules → managed rules → platform rules → Custom Rules → AI profile.
  • Firewall Rules allow/bypass skip the entire WAF (managed rules through AI profile). Use them with care.
  • Access Control allow runs even earlier and skips the WAF as well.
  • Within Custom Rules: priority determines the order; action: allow lets the request skip the remaining signature stages.
  • A Custom Rule allow cannot skip managed rules: managed rules run before Custom Rules, so an allow in Custom Rules cannot "unlock" a request that a managed rule has already blocked (it is still 403). Only Firewall Rules allow/bypass, which run first, can skip all WAF stages.

Troubleshooting​

SymptomCauseFix
Enabling the WAF returns 403WAF is not enabled for the organization, or the WAF quota has been used upContact support to enable it or raise the quota
Saving a Custom Rule returns 400The expression does not compile or uses an invalid fieldUse Test expression; only use fields from the list above
Test expression returns {valid:false} with HTTP 200This is the syntax check result, not an HTTP errorRead error in the response body and fix the expression
Legitimate visitors are blocked (false positive)A managed rule is too sensitiveAdd the rule ID to Disabled managed rules or the path to Path exceptions, or run with Mode = detect to investigate
WAF JA4 cannot be turned off (409)Rate Limit is using by_ja4Turn off by_ja4 in Rate Limit first

FAQ​

  • What is the difference between block and detect? block actually blocks (403); detect only logs. Use detect to test rules before blocking.
  • What should Threat threshold be set to? Leave it at 0 (= the default of 80). Lower it if you want more sensitivity, but expect more false positives.
  • I want to filter by geography but keep the WAF for visitors from Vietnam. Use a Custom Rule or Firewall Rule with a geo condition. Do not use Access Control allow country, because it skips the WAF.
  • How do I check whether a rule works? Write the expression → Test expression to confirm the syntax → save it as block → test with curl and check the Events tab.