{
 "name": "resulthack server-rule sources",
 "description": "The server documentation every \"Block or allow it at the server\" rule on resulthack.com is written from. Each source was fetched with a plain GET on its date; each quote was found on that page word for word (markup removed, white space folded). forms lists every line shape the generator prints and the quotes that show it; a placeholder in angle brackets is filled from the operator data (crawlers.json and html/data/ipranges/).",
 "fetched": "2026-10-09",
 "sources": [
  {
   "id": "nginx-rewrite",
   "short": "rewrite module",
   "server": "nginx",
   "title": "nginx documentation: Module ngx_http_rewrite_module (if, return)",
   "url": "https://nginx.org/en/docs/http/ngx_http_rewrite_module.html",
   "fetched": "2026-10-09",
   "quotes": [
    "if ($http_user_agent ~ MSIE) {",
    "if ($invalid_referer) { return 403; }",
    "a variable name; false if the value of a variable is an empty string or “0”;",
    "Context: server, location"
   ]
  },
  {
   "id": "nginx-map",
   "short": "map module",
   "server": "nginx",
   "title": "nginx documentation: Module ngx_http_map_module",
   "url": "https://nginx.org/en/docs/http/ngx_http_map_module.html",
   "fetched": "2026-10-09",
   "quotes": [
    "map $http_user_agent $mobile { default 0; \"~Opera Mini\" 1; }",
    "The resulting value can contain text, variable (0.9.0), and their combination (1.11.0).",
    "A regular expression should either start from the “~” symbol for a case-sensitive matching",
    "Context: http"
   ]
  },
  {
   "id": "nginx-geo",
   "short": "geo module",
   "server": "nginx",
   "title": "nginx documentation: Module ngx_http_geo_module",
   "url": "https://nginx.org/en/docs/http/ngx_http_geo_module.html",
   "fetched": "2026-10-09",
   "quotes": [
    "geo $geo { default 0; 127.0.0.1 2; 192.168.1.0/24 1;",
    "2001:0db8::/32 1;",
    "By default, the address is taken from the $remote_addr variable"
   ]
  },
  {
   "id": "apache-access",
   "short": "Access Control",
   "server": "apache",
   "title": "Apache HTTP Server 2.4 documentation: Access Control",
   "url": "https://httpd.apache.org/docs/2.4/howto/access.html",
   "fetched": "2026-10-09",
   "quotes": [
    "<If \"%{HTTP_USER_AGENT} == 'BadBot'\"> Require all denied </If>",
    "Access control by User-Agent is an unreliable technique, since the User-Agent header can be set to anything at all, at the whim of the end user.",
    "Using the <If>, you can allow or deny access based on arbitrary environment variables or request header values."
   ]
  },
  {
   "id": "apache-core",
   "short": "<If>",
   "server": "apache",
   "title": "Apache HTTP Server 2.4 documentation: core, the <If> directive",
   "url": "https://httpd.apache.org/docs/2.4/mod/core.html",
   "fetched": "2026-10-09",
   "quotes": [
    "Syntax: <If expression> ... </If> Context: server config, virtual host, directory, .htaccess"
   ]
  },
  {
   "id": "apache-expr",
   "short": "expressions",
   "server": "apache",
   "title": "Apache HTTP Server 2.4 documentation: Expressions in Apache HTTP Server",
   "url": "https://httpd.apache.org/docs/2.4/expr.html",
   "fetched": "2026-10-09",
   "quotes": [
    "<If \"%{QUERY_STRING} =~ /forcetext/\">"
   ]
  },
  {
   "id": "apache-authz-core",
   "short": "mod_authz_core",
   "server": "apache",
   "title": "Apache HTTP Server 2.4 documentation: mod_authz_core",
   "url": "https://httpd.apache.org/docs/2.4/mod/mod_authz_core.html",
   "fetched": "2026-10-09",
   "quotes": [
    "When multiple Require directives are used in a single configuration section and are not contained in another authorization directive like <RequireAll>, they are implicitly contained within a <RequireAny> directive."
   ]
  },
  {
   "id": "apache-authz-host",
   "short": "mod_authz_host",
   "server": "apache",
   "title": "Apache HTTP Server 2.4 documentation: mod_authz_host (Require ip)",
   "url": "https://httpd.apache.org/docs/2.4/mod/mod_authz_host.html",
   "fetched": "2026-10-09",
   "quotes": [
    "Require ip 192.168.1.104 192.168.1.205",
    "Require ip 10.1.0.0/16",
    "Require ip 2001:db8:2:1::/64"
   ]
  },
  {
   "id": "caddy-matchers",
   "short": "request matchers",
   "server": "caddy",
   "title": "Caddy documentation: Request matchers (Caddyfile)",
   "url": "https://caddyserver.com/docs/caddyfile/matchers",
   "fetched": "2026-10-09",
   "quotes": [
    "@upgrade header Connection *Upgrade*",
    "If enclosed by *, it performs a fast substring match (appears anywhere).",
    "reverse_proxy @websockets localhost:6001",
    "@websockets { header Connection *Upgrade* header Upgrade websocket }",
    "or, to negate multiple matchers which get AND'ed, open a block: not { <matchers...> }",
    "client_ip <ranges...>",
    "@private-ipv4 client_ip 192.168.0.0/16 172.16.0.0/12 10.0.0.0/8 127.0.0.1/8",
    "There can be multiple client_ip matchers per named matcher, and their ranges will be merged and OR'ed together.",
    "Like directives, named matcher definitions must go inside the site blocks that use them.",
    "This matcher is best used when the trusted_proxies global option is configured, otherwise it acts identically to the remote_ip matcher."
   ]
  },
  {
   "id": "caddy-respond",
   "short": "respond",
   "server": "caddy",
   "title": "Caddy documentation: respond (Caddyfile directive)",
   "url": "https://caddyserver.com/docs/caddyfile/directives/respond",
   "fetched": "2026-10-09",
   "quotes": [
    "respond [<matcher>] <status>|<body> [<status>] {",
    "respond /health-check 200",
    "respond /secret/* \"Access denied\" 403 {"
   ]
  },
  {
   "id": "cf-bad-bots",
   "short": "custom rule example",
   "server": "cloudflare",
   "title": "Cloudflare docs: Challenge bad bots (WAF custom rules)",
   "url": "https://developers.cloudflare.com/waf/custom-rules/use-cases/challenge-bad-bots/",
   "fetched": "2026-10-09",
   "quotes": [
    "Expression: (cf.bot_management.score lt 2 and http.user_agent contains \"App_Name 2.0\") Action: Block",
    "Action: Block"
   ]
  },
  {
   "id": "cf-operators",
   "short": "operators",
   "server": "cloudflare",
   "title": "Cloudflare docs: Rules language, operators and grouping symbols",
   "url": "https://developers.cloudflare.com/ruleset-engine/rules-language/operators/",
   "fetched": "2026-10-09",
   "quotes": [
    ") and not ip.src in {11.22.33.0/24}"
   ]
  },
  {
   "id": "cf-values",
   "short": "values and lists",
   "server": "cloudflare",
   "title": "Cloudflare docs: Rules language, values (lists, inline lists)",
   "url": "https://developers.cloudflare.com/ruleset-engine/rules-language/values/",
   "fetched": "2026-10-09",
   "quotes": [
    "ip.src in {198.51.100.1 198.51.100.3..198.51.100.7 192.0.2.0/24 2001:0db8::/32}",
    "(ip.src in $office_network)",
    "List names can only include lowercase letters, numbers, and the underscore (_) character."
   ]
  },
  {
   "id": "cf-expressions",
   "short": "expressions",
   "server": "cloudflare",
   "title": "Cloudflare docs: Rules language, expressions",
   "url": "https://developers.cloudflare.com/ruleset-engine/rules-language/expressions/",
   "fetched": "2026-10-09",
   "quotes": [
    "The maximum length of a rule expression is 4,096 characters."
   ]
  },
  {
   "id": "cf-user-agent",
   "short": "http.user_agent",
   "server": "cloudflare",
   "title": "Cloudflare docs: Rules language field http.user_agent",
   "url": "https://developers.cloudflare.com/ruleset-engine/rules-language/fields/reference/http.user_agent/",
   "fetched": "2026-10-09",
   "quotes": [
    "The HTTP User-Agent request header"
   ]
  }
 ],
 "forms": [
  {
   "server": "nginx",
   "form": "if ($http_user_agent ~ <pattern>) {",
   "quotes": [
    {
     "source": "nginx-rewrite",
     "quote": "if ($http_user_agent ~ MSIE) {"
    }
   ]
  },
  {
   "server": "nginx",
   "form": "return 403;",
   "quotes": [
    {
     "source": "nginx-rewrite",
     "quote": "if ($invalid_referer) { return 403; }"
    }
   ]
  },
  {
   "server": "nginx",
   "form": "}",
   "quotes": [
    {
     "source": "nginx-rewrite",
     "quote": "if ($invalid_referer) { return 403; }"
    }
   ]
  },
  {
   "server": "nginx",
   "form": "geo <var> {",
   "quotes": [
    {
     "source": "nginx-geo",
     "quote": "geo $geo { default 0; 127.0.0.1 2; 192.168.1.0/24 1;"
    }
   ]
  },
  {
   "server": "nginx",
   "form": "default <value>;",
   "quotes": [
    {
     "source": "nginx-geo",
     "quote": "geo $geo { default 0; 127.0.0.1 2; 192.168.1.0/24 1;"
    },
    {
     "source": "nginx-map",
     "quote": "map $http_user_agent $mobile { default 0; \"~Opera Mini\" 1; }"
    }
   ]
  },
  {
   "server": "nginx",
   "form": "<range> <value>;",
   "quotes": [
    {
     "source": "nginx-geo",
     "quote": "geo $geo { default 0; 127.0.0.1 2; 192.168.1.0/24 1;"
    },
    {
     "source": "nginx-geo",
     "quote": "2001:0db8::/32 1;"
    }
   ]
  },
  {
   "server": "nginx",
   "form": "map $http_user_agent <var> {",
   "quotes": [
    {
     "source": "nginx-map",
     "quote": "map $http_user_agent $mobile { default 0; \"~Opera Mini\" 1; }"
    }
   ]
  },
  {
   "server": "nginx",
   "form": "\"~<pattern>\" <value>;",
   "quotes": [
    {
     "source": "nginx-map",
     "quote": "map $http_user_agent $mobile { default 0; \"~Opera Mini\" 1; }"
    },
    {
     "source": "nginx-map",
     "quote": "The resulting value can contain text, variable (0.9.0), and their combination (1.11.0)."
    },
    {
     "source": "nginx-map",
     "quote": "A regular expression should either start from the “~” symbol for a case-sensitive matching"
    }
   ]
  },
  {
   "server": "nginx",
   "form": "if (<var>) {",
   "quotes": [
    {
     "source": "nginx-rewrite",
     "quote": "if ($invalid_referer) { return 403; }"
    },
    {
     "source": "nginx-rewrite",
     "quote": "a variable name; false if the value of a variable is an empty string or “0”;"
    }
   ]
  },
  {
   "server": "apache",
   "form": "<If \"%{HTTP_USER_AGENT} =~ /<pattern>/\">",
   "quotes": [
    {
     "source": "apache-access",
     "quote": "<If \"%{HTTP_USER_AGENT} == 'BadBot'\"> Require all denied </If>"
    },
    {
     "source": "apache-expr",
     "quote": "<If \"%{QUERY_STRING} =~ /forcetext/\">"
    }
   ]
  },
  {
   "server": "apache",
   "form": "Require all denied",
   "quotes": [
    {
     "source": "apache-access",
     "quote": "<If \"%{HTTP_USER_AGENT} == 'BadBot'\"> Require all denied </If>"
    }
   ]
  },
  {
   "server": "apache",
   "form": "</If>",
   "quotes": [
    {
     "source": "apache-access",
     "quote": "<If \"%{HTTP_USER_AGENT} == 'BadBot'\"> Require all denied </If>"
    }
   ]
  },
  {
   "server": "apache",
   "form": "Require ip <ranges>",
   "quotes": [
    {
     "source": "apache-authz-host",
     "quote": "Require ip 192.168.1.104 192.168.1.205"
    },
    {
     "source": "apache-authz-host",
     "quote": "Require ip 10.1.0.0/16"
    },
    {
     "source": "apache-authz-host",
     "quote": "Require ip 2001:db8:2:1::/64"
    }
   ]
  },
  {
   "server": "caddy",
   "form": "@<name> header User-Agent *<pattern>*",
   "quotes": [
    {
     "source": "caddy-matchers",
     "quote": "@upgrade header Connection *Upgrade*"
    },
    {
     "source": "caddy-matchers",
     "quote": "If enclosed by *, it performs a fast substring match (appears anywhere)."
    },
    {
     "source": "cf-user-agent",
     "quote": "The HTTP User-Agent request header"
    }
   ]
  },
  {
   "server": "caddy",
   "form": "respond @<name> 403",
   "quotes": [
    {
     "source": "caddy-respond",
     "quote": "respond [<matcher>] <status>|<body> [<status>] {"
    },
    {
     "source": "caddy-respond",
     "quote": "respond /health-check 200"
    },
    {
     "source": "caddy-respond",
     "quote": "respond /secret/* \"Access denied\" 403 {"
    },
    {
     "source": "caddy-matchers",
     "quote": "reverse_proxy @websockets localhost:6001"
    }
   ]
  },
  {
   "server": "caddy",
   "form": "@<name> {",
   "quotes": [
    {
     "source": "caddy-matchers",
     "quote": "@websockets { header Connection *Upgrade* header Upgrade websocket }"
    }
   ]
  },
  {
   "server": "caddy",
   "form": "header User-Agent *<pattern>*",
   "quotes": [
    {
     "source": "caddy-matchers",
     "quote": "@websockets { header Connection *Upgrade* header Upgrade websocket }"
    },
    {
     "source": "cf-user-agent",
     "quote": "The HTTP User-Agent request header"
    }
   ]
  },
  {
   "server": "caddy",
   "form": "not {",
   "quotes": [
    {
     "source": "caddy-matchers",
     "quote": "or, to negate multiple matchers which get AND'ed, open a block: not { <matchers...> }"
    }
   ]
  },
  {
   "server": "caddy",
   "form": "client_ip <ranges>",
   "quotes": [
    {
     "source": "caddy-matchers",
     "quote": "client_ip <ranges...>"
    },
    {
     "source": "caddy-matchers",
     "quote": "@private-ipv4 client_ip 192.168.0.0/16 172.16.0.0/12 10.0.0.0/8 127.0.0.1/8"
    },
    {
     "source": "caddy-matchers",
     "quote": "There can be multiple client_ip matchers per named matcher, and their ranges will be merged and OR'ed together."
    }
   ]
  },
  {
   "server": "caddy",
   "form": "}",
   "quotes": [
    {
     "source": "caddy-matchers",
     "quote": "@websockets { header Connection *Upgrade* header Upgrade websocket }"
    }
   ]
  },
  {
   "server": "cloudflare",
   "form": "(http.user_agent contains \"<pattern>\")",
   "quotes": [
    {
     "source": "cf-bad-bots",
     "quote": "Expression: (cf.bot_management.score lt 2 and http.user_agent contains \"App_Name 2.0\") Action: Block"
    }
   ]
  },
  {
   "server": "cloudflare",
   "form": "(http.user_agent contains \"<pattern>\" and not ip.src in {<ranges>})",
   "quotes": [
    {
     "source": "cf-bad-bots",
     "quote": "Expression: (cf.bot_management.score lt 2 and http.user_agent contains \"App_Name 2.0\") Action: Block"
    },
    {
     "source": "cf-operators",
     "quote": ") and not ip.src in {11.22.33.0/24}"
    },
    {
     "source": "cf-values",
     "quote": "ip.src in {198.51.100.1 198.51.100.3..198.51.100.7 192.0.2.0/24 2001:0db8::/32}"
    }
   ]
  },
  {
   "server": "cloudflare",
   "form": "(http.user_agent contains \"<pattern>\" and not ip.src in $<name>)",
   "quotes": [
    {
     "source": "cf-bad-bots",
     "quote": "Expression: (cf.bot_management.score lt 2 and http.user_agent contains \"App_Name 2.0\") Action: Block"
    },
    {
     "source": "cf-operators",
     "quote": ") and not ip.src in {11.22.33.0/24}"
    },
    {
     "source": "cf-values",
     "quote": "(ip.src in $office_network)"
    },
    {
     "source": "cf-values",
     "quote": "List names can only include lowercase letters, numbers, and the underscore (_) character."
    }
   ]
  }
 ],
 "notes": {
  "uaUnreliable": {
   "source": "apache-access",
   "quote": "Access control by User-Agent is an unreliable technique, since the User-Agent header can be set to anything at all, at the whim of the end user."
  },
  "nginxHttp": {
   "source": "nginx-map",
   "quote": "Context: http"
  },
  "nginxGeoAddr": {
   "source": "nginx-geo",
   "quote": "By default, the address is taken from the $remote_addr variable"
  },
  "nginxIfContext": {
   "source": "nginx-rewrite",
   "quote": "Context: server, location"
  },
  "apacheIfUse": {
   "source": "apache-access",
   "quote": "Using the <If>, you can allow or deny access based on arbitrary environment variables or request header values."
  },
  "apacheIfContext": {
   "source": "apache-core",
   "quote": "Syntax: <If expression> ... </If> Context: server config, virtual host, directory, .htaccess"
  },
  "apacheImplicitAny": {
   "source": "apache-authz-core",
   "quote": "When multiple Require directives are used in a single configuration section and are not contained in another authorization directive like <RequireAll>, they are implicitly contained within a <RequireAny> directive."
  },
  "caddySite": {
   "source": "caddy-matchers",
   "quote": "Like directives, named matcher definitions must go inside the site blocks that use them."
  },
  "caddyClientIp": {
   "source": "caddy-matchers",
   "quote": "This matcher is best used when the trusted_proxies global option is configured, otherwise it acts identically to the remote_ip matcher."
  },
  "cfBlock": {
   "source": "cf-bad-bots",
   "quote": "Action: Block"
  },
  "cfListName": {
   "source": "cf-values",
   "quote": "List names can only include lowercase letters, numbers, and the underscore (_) character."
  }
 },
 "limits": [
  {
   "server": "cloudflare",
   "what": "length of one rule expression",
   "max": 4096,
   "source": "cf-expressions",
   "quote": "The maximum length of a rule expression is 4,096 characters."
  }
 ]
}
