Skip to content

Traefik Warden: Configuration Reference ​

This reference covers all configuration options available in Traefik Warden.


Core Options ​

KeyTypeDefaultDescription
configFilestring""Path to a routewarden.json file loaded as the base config. Inline fields always take precedence over the file.
enabledbooltrueEnables or disables the middleware. When false, all traffic passes through.
debugboolfalseEnables verbose diagnostic logging for request candidate normalization, method matching, and allow/block evaluation details.
securityLogbooltrueEmits single-line structured JSON security audit events on stdout for CrowdSec, SIEMs, or fail2ban on blocked requests.
enableDefaultPatternsbooltrueEnables built-in protection for .env*, .git, .aws, .sql, backups, and logs.
enableDefaultAllowPatternsbooltrueEnables built-in allowlist exemptions (/robots.txt, /sitemap.xml, /ads.txt, /security.txt, /.well-known/*). Set to false to disable.
blockPatterns[]string[]List of custom regular expressions to block (matches against normalized path).
allowPatterns[]string[]Additional custom regex patterns to explicitly allow even if matching blocked rules.
allowedIps[]string[]Whitelisted IPv4/IPv6 addresses or CIDR subnets (e.g., 10.0.0.0/8, 127.0.0.1).
allowedASNs[]string[]List of Autonomous System Numbers ("64500" or "AS64500") whose client IPs bypass inspection. Requires asnDB.
blockedASNs[]string[]List of hostile or crawler Autonomous System Numbers whose client IPs are blocked. Requires asnDB.
asnDBstring""Absolute filesystem path to local JSON ASN-to-CIDR routing snapshot file.
botDefenseLevelstring""Preset bot defense level ("off", "light", "standard", "strict", "aggressive"). Activates pre-tuned combinations of AI bot defense, browser impersonation checks, script client blocking, and FCrDNS.
blockAIBotsboolfalseEnables automatic blocking of known AI scrapers, LLM training bots, and crawlers.
aiBotProfilestring""AI bot profile filter: train_only (default), search_only, agents_only, all, aggressive, or custom.
blockUserAgents[]string[]Custom regular expression patterns matching client User-Agents to block.
allowUserAgents[]string[]Custom regular expression patterns matching client User-Agents to permit.
detectBrowserImpersonationboolfalseCross-validates claimed browser User-Agents against Client Hints (Sec-CH-UA-Platform, Sec-CH-UA-Mobile, Sec-CH-UA brand integrity with GREASE verification), Chromium Fetch Metadata (Sec-Fetch-*), companion headers (Accept-Language, Accept-Encoding), and header ordering anomalies.
blockScriptClientsboolfalseBlocks automated HTTP client library signatures (requests, Guzzle, reqwest, axios, curl) and headless automation framework headers (X-Playwright, X-Puppeteer, X-Cypress, Sec-WebDriver).
blockCloudHostsboolfalseIdentifies and blocks requests originating from major cloud hosting and datacenter ASNs (AWS, GCP, Azure, Hetzner, etc.), dropping datacenter scrapers and browser impersonators while exempting verified search crawlers and route allow patterns.
verifySearchEngineBotsboolfalseVerifies genuine search engine crawlers (Google, Bing, Apple, Yandex, Baidu, DuckDuckGo, Yahoo, Naver, Sogou, Mojeek) via Forward-Confirmed Reverse DNS (FCrDNS), dropping spoofed impersonators.
honeypotTrapPaths[]string[]Hidden decoy URL paths. Any client requesting these paths triggers an instant IP ban in an in-memory sliding-window table.
enableRobotsTxtHoneypotboolfalseDynamically injects daily rotating Disallow: /rw_trap<token>/ entries into /robots.txt and bans scrapers that crawl them. Synthesizes 200 OK when upstream 404s.
robotsTxtHoneypotSecretstring""Secret seed used to derive deterministic HMAC-SHA256 daily rotating tokens for robots.txt honeypot traps.
trapBanDurationstring"24h"Sliding-window ban duration for trapped client IPs (e.g., 24h, 1h, 30m).
trustedProxies[]string[]Upstream proxies/load-balancers trusted for X-Forwarded-For / X-Real-IP. Untrusted connections use socket IP directly.
methods[]string["GET"]HTTP request verbs to inspect (e.g. ["GET", "POST"]). Supports wildcard "*" or "ALL" to inspect all verbs. Auto-expanded to include POST, PUT, PATCH when checkBody is enabled without explicit methods.
checkQueryboolfalseAlso inspects the URL raw query string for blocked patterns.
checkHeaders[]string[]Optional list of HTTP request headers to inspect for path smuggling (e.g. ["X-Forwarded-Uri", "X-Rewrite-URL"]).
checkBodyboolfalseWhen true, buffers and inspects request bodies against blocked patterns (auto-expands default methods to include POST, PUT, PATCH).
checkBodyMaxBytesint6465536Maximum bytes to buffer for body inspection (default: 64KB).
checkBodyPatterns[]string[]Specific regex patterns to match against request body (falls back to blockPatterns if empty).
statusCodeint403Default HTTP status code when request is blocked (legacy shortcut).

Config File (configFile) ​

Instead of inlining every configuration option in traefik.yml or Docker labels, you can point Routewarden at a shared routewarden.json file. This is especially useful for self-hosters managing multiple services or for keeping security policy in version control independently of your Traefik config.

http:  middlewares:    warden:      plugin:        routewarden:          configFile: /etc/routewarden/routewarden.json          # Inline fields override file values — e.g. override just the response mode:          response:            mode: tarpit

The routewarden.json file uses the standard Routewarden JSON schema (view it with rwarden schema or the CLI Schema):

Merge Semantics ​

PrioritySource
1 (wins)Inline fields in traefik.yml / Docker labels
2 (base)Fields from configFile
  • Non-zero inline values always override the corresponding file values.
  • Empty/omitted slices in the inline config defer to the file (so you don't need to re-specify blockPatterns just to change the response mode).
  • A missing or malformed file causes a hard startup error — Routewarden will not silently fall back to defaults.

TIP

Mount routewarden.json as a Docker volume or Kubernetes ConfigMap and share it across multiple Traefik middleware instances for consistent policy enforcement across services.


ASN Allowlisting (allowedASNs & asnDB) ​

Traefik Warden supports Autonomous System Number (ASN) based allowlisting using an offline JSON routing snapshot compiled from MaxMind GeoLite2/GeoIP2 ASN CSV data with scripts/build-asn-db.py.

traefik.ymlyaml
http:  middlewares:    warden:      plugin:        routewarden:          allowedASNs:            - "AS13335" # Cloudflare            - "64500"   # Corporate Network          asnDB: /etc/routewarden/asn.json          trustedProxies:            - "10.0.0.0/8"

When a request originates from an IP prefix mapped to an allowed ASN in asnDB, Routewarden immediately bypasses path and body inspection (identical to allowedIps). Client-supplied ASN headers (e.g. CF-Connecting-ASN) are strictly ignored; only the socket peer or sanitized IPs from trustedProxies are matched.

For routing snapshot build instructions, JSON formatting, and longest-prefix matching details, refer to the ASN Filtering Guide.


Security Audit Logging (securityLog) ​

Routewarden includes built-in structured security audit logging designed for CrowdSec, SIEM platforms (Elasticsearch, Loki, Splunk, Datadog), and automated intrusion remediation tools.

When securityLog: true (the default), every intercepted probe emits a single-line JSON payload to stdout:

routewarden_block.jsonjson
{  "type": "routewarden_block",  "timestamp": "2026-09-19T15:30:00Z",  "plugin": "routewarden",  "client_ip": "198.51.100.42",  "method": "GET",  "path": "/.env",  "request_uri": "/.env",  "pattern": "(?i)(^|/)(\\.env.*|.*\\.(txt|log|bak|backup|sql|conf|config|ini|yaml|yml))$",  "action": "json",  "reason": "path_blocked",  "user_agent": "Nuclei/v3.1.0"}
FieldDescription
typeConstant identifier routewarden_block for log parsers and alerting rules.
timestampISO-8601 UTC timestamp of the interception.
pluginMiddleware instance name.
client_ipRemote client IP extracted from socket RemoteAddr, X-Forwarded-For, or X-Real-IP.
methodHTTP request verb (GET, POST, etc.).
pathNormalized candidate path that triggered the match.
request_uriOriginal raw URI requested by the client.
patternRegular expression pattern that triggered the block.
actionResponse mode executed (json, html, fakeSuccess, silentDrop, etc.).
reasonBlock trigger classification (path_blocked, query_blocked, query_param_blocked, header_blocked).
user_agentInbound client User-Agent header string.

For complete end-to-end integration steps with automated firewall remediation, see the CrowdSec Integration Guide.


Built-in Default Patterns ​

Default Block Patterns (enableDefaultPatterns: true) ​

When enableDefaultPatterns: true (default), Routewarden intercepts requests matching these compiled regular expressions:

Target CategoryCompiled RegexIntercepted Examples
Environment & Configs(?i)(^|/)(\.env.\|.\.(txt\|log\|bak\|backup\|sql\|conf\|config\|ini\|yaml\|yml))$/.env, /.env.production, /app.config, /dump.sql, /debug.log, /app.ini
VCS & Hidden Metadata(?i)(^|/)\.(git\|svn\|hg\|bzr\|cvs)(/.*\|$)/.git/config, /.git/HEAD, /.svn/entries
Cloud & Shell Credentials(?i)(^|/)\.(aws\|ssh\|kube\|docker)(/.*\|$)/.aws/credentials, /.ssh/id_rsa, /.kube/config
Archives & DB Dumps(?i).*\.(tar\|tar\.gz\|tgz\|zip\|rar\|7z\|gz\|bz2\|iso\|dump\|sqlite\|sqlite3\|db)$/backup.tar.gz, /site.zip, /users.dump, /data.sqlite3
Sensitive Admin & Metrics(?i)(^|/)(phpinfo\.php\|info\.php\|server-status\|server-info\|actuator(/.*)?\|metrics\|heapdump\|trace\|env)$/phpinfo.php, /server-status, /actuator/health, /metrics
Package Managers & Locks(?i)(^|/)(composer\.(json\|lock)\|package-lock\.json\|yarn\.lock\|pnpm-lock\.yaml\|Pipfile\|Pipfile\.lock\|requirements\.txt)$/package-lock.json, /yarn.lock, /composer.lock, /requirements.txt
TLS Keys & Keystores(?i).*\.(pem\|key\|crt\|pfx\|p12\|jks\|kdb)$/server.key, /cert.pem, /keystore.p12
Container Manifests(?i)(^|/)(dockerfile.\|docker-compose.\.ya?ml)$/Dockerfile, /docker-compose.yml, /docker-compose.prod.yaml
OS Metadata Structure(?i)(^|/)\.ds_store$/.DS_Store
CMS & Framework Configs(?i)(^|/)(wp-config\.php.\|configuration\.php.\|settings\.py\|local_settings\.py)$/wp-config.php, /configuration.php, /settings.py

Default Allow Patterns (enableDefaultAllowPatterns: true) ​

When enableDefaultAllowPatterns: true (default), Routewarden immediately permits standard public and ACME paths before testing block patterns:

Target ResourceCompiled Regex
Crawler Indexing Directives(?i)^/robots\.txt$
Search Engine XML Sitemaps(?i)^/sitemap.*\.xml$
Digital Ad Transparency(?i)^/ads\.txt$
Security Disclosure Policies(?i)^/security\.txt$
ACME & Web Standards(?i)^/\.well-known(/.*)?$

Response Configuration (response) ​

📖 Deep Dive: For an in-depth breakdown of all 15 response behaviors, limitations, attacker impacts, and security cautions, visit the Response Modes Reference.

KeyTypeDefaultDescription
modestring"text"Response mode: json, html, text, xml, redirect, captcha, silentDrop, gzipBomb (bomb), tarpit, fakeSuccess (decoy), rateLimitChallenge (ratelimit), proxy (mirror), infiniteStream (garbagestream), aiPoison, markovTarpit, or powChallenge (pow, proofOfWork, hashcash).
statusCodeint403HTTP status code returned to client (use 200 for honeypots / deception, 429 for rate limit challenge or powChallenge).
bodystring""Response body for json, html, xml, or text mode.
headersmap[string]string{}Custom HTTP response headers injected into blocked responses.
redirectUrlstring""Target URL when mode: redirect.
proxyUrlstring""Target backend honeypot URL when mode: proxy (transparent reverse-proxy).
captchaobject{}Captcha challenge options when mode: captcha.
gzipBombMBfloat10Uncompressed stream size in Megabytes when mode: gzipBomb (expands ~1000x on client memory; supports fractional values e.g. 0.5).
retryAfterSecondsint300Value for Retry-After header when mode: rateLimitChallenge.
tarpitDelayMsint1000Milliseconds between trickle bytes when mode: tarpit (stalls scanner connections).
tarpitMaxDurationSecondsint60Maximum seconds before terminating stalled connection in mode: tarpit.
streamSizeMBint50Total garbage data size in Megabytes when mode: infiniteStream.
powDifficultyint16Required leading zero bits in SHA-256 output when mode: powChallenge (recommended: 8–24).
powSecretstring""Secret seed used to compute HMAC-SHA256 signatures for stateless challenge verification when mode: powChallenge.
powTimeoutSecondsint300Expiration and validity window in seconds for proof-of-work challenges and solution tokens.

Captcha Options (response.captcha) ​

KeyTypeDefaultDescription
providerstring"turnstile"Captcha provider: turnstile, hcaptcha, or recaptcha.
siteKey / site_keystring""Public site key for the captcha widget (accepts camelCase siteKey or snake_case site_key).
titlestring"Verification"Heading displayed on the verification challenge page.
templatestring""Optional custom HTML template string override.

HTTP Request Verbs Inspection (methods) ​

By default, Routewarden inspects incoming GET requests (methods: ["GET"]), as automated scanners and vulnerability reconnaissance probes primarily use GET to check for leaked files (.env, .git, backups, configs).

You can configure methods to inspect additional HTTP request verbs (e.g. POST, PUT, DELETE, PATCH, HEAD) or tailor inspection to specific workloads. Any incoming request whose HTTP method is not included in methods will immediately bypass inspection and pass downstream to upstream containers.

Wildcard Methods (* and ALL) ​

To inspect all incoming HTTP request methods without enumerating each verb individually, supply "*" or "ALL" (case-insensitive):

traefik.yamlyaml
methods:  - "*"

Automatic Method Expansion for Request Body Inspection ​

When body inspection is enabled (checkBody: true or custom checkBodyPatterns configured) and methods is left at the default ["GET"], Routewarden automatically expands methods to:

traefik.yamlyaml
methods:  - "GET"  - "POST"  - "PUT"  - "PATCH"

This ensures that incoming payload-bearing mutation requests (POST, PUT, PATCH) are inspected automatically without requiring boilerplate configuration. If you explicitly specify methods, your custom list is preserved as configured.

Configuration Examples ​

http:  middlewares:    routewarden:      plugin:        routewarden:          enabled: true          enableDefaultPatterns: true          # Inspect GET and POST requests (default: ["GET"])          methods:            - "GET"            - "POST"

Released under the MIT License.