TurtleGuard

Docs / Rules and filters

Custom rules

Block, challenge, let through and redirect requests on your own conditions.

3 minute readUpdated 2026-11-07

Custom rules decide what to do with a request on your own conditions: block it, show a check, let it past the WAF or just log it. Redirects and header changes are set up next to them.

Where to set them

In the panel: domain → Rules → Security. The same page has the Redirects, URL rewrites, Headers and Bulk redirects tabs.

Conditions

A rule is a set of conditions joined by “all of” or “any of”, with “not” to negate. One rule holds up to 10 conditions and up to two levels of nested groups.

What is checkedFields
Request addressPath, full URI, query string, parameter, host, method, HTTP version
HeadersHeader, cookie, User-Agent, referer
Where fromIP, country, network (AS)
WhoJA4 fingerprint, verified bot
ContentRequest body

Comparisons: equals, contains, starts with, ends with, matches regex, in list, in subnet, present — each can be negated with “not”.

  • Case does not matter, except for regular expressions: they are case-sensitive.
  • Country and network compare only with “equals” and “in list”; “in subnet” works for IP only.
  • List values are separated by commas or new lines.

Actions

ActionWhat it does
AllowLets the request past the managed WAF rules
BlockAnswers 403
ChallengeShows the browser check
CaptchaShows the slider captcha
LogOnly marks the request in the log
Skip…Turns off chosen layers for the request: WAF, limits, check, shared offender lists, geo — or single WAF rules by ID

“Allow” and the browser check

“Allow” also removes the browser check only when every condition is on IP, path, URI, query, host, method, country, network or verified bot. User-Agent, headers, cookies and body are easy to fake, so with them the check stays.

Order

Rules run top to bottom; drag to reorder. The first matching Allow, Block, Challenge or Captcha decides the request. Log and Skip do not stop the following rules.

The whole path of a request through a node:

  1. Address allow and deny lists.
  2. JA4 fingerprint block.
  3. Your rules: blocks happen here.
  4. Shared offender lists, then geo rules.
  5. Per-address request limit.
  6. HTTPS redirect, redirects and rewrites.
  7. Browser check and captcha — from your rules and the protection mode.
  8. Managed WAF rules (OWASP CRS).

In Passive mode, Block, Challenge and Captcha are only logged. If the WAF is off for the site, custom rules do not run.

Test before saving

Preview runs the draft rule over the last day of the log and shows which requests it would hit. Matches on headers, cookies, parameters and body are approximate: they are not stored in full.

Plan limits

No planPaid plan
Security rules325
Transform rules550
Redirects2010,000

The exact limits of your plan are on the plan page in the panel.

Rate limiting

There are no separate rate-limit rules. There is one threshold: domain → Settings → Request filter → “Per-address request threshold” — how many requests a minute one IP may send (at least 60, 0 turns it off). Above it requests from the address are limited. After the browser check the visitor is counted instead of the address, so people behind one NAT do not affect each other.

Redirects and headers

  • Redirects: codes 301, 302, 307, 308 (301 by default). The first matching redirect fires, then bulk lists. A * in the source path goes to the target as ${1}…${9}.
  • The target can use ${host}, ${path}, ${query}, ${uri}, ${scheme}, ${country} and more. Loops are caught on save.
  • Rewrite changes the path before it goes to the server; every matching rule applies. Headers — set, add or remove, up to 20 operations per rule.
  • Ready templates: www to apex and back, trailing slash, security headers, CSP report-only, CORS, noindex for staging, hide the Server header.
  • Bulk redirects are uploaded as a CSV file up to 8 MB: source,target[,status[,preserve_query]], separated by comma or semicolon.
  • Check a URL shows which redirects and rewrites fire for an address. It does not check security rules.
example: send visitors from Kazakhstan elsewhere
condition: Country equals KZ
action:    redirect 302 to https://kz.example.com${uri}