Skip to content

Configuration Reference ​

This reference covers all configuration options available in RouteWarden.


Core Options ​

KeyTypeDefaultDescription
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.
pathPatterns[]string[]List of custom regular expressions to block (matches against normalized path).
blockPatterns[]string[]Alias for pathPatterns.
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).
methods[]string["GET"]HTTP request verbs to inspect (e.g. ["GET", "POST"]). Non-matching verbs bypass inspection.
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"]).
statusCodeint403Default HTTP status code when request is blocked (legacy shortcut).

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:

json
{"action":"json","client_ip":"198.51.100.42","method":"GET","path":"/.env","pattern":"(?i)(^|/)(\\.env.*|.*\\.(txt|log|bak|backup|sql|conf|config|ini|yaml|yml))$","plugin":"routewarden","reason":"path_blocked","request_uri":"/.env","timestamp":"2026-09-19T15:30:00Z","type":"routewarden_block","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 11+ response behaviors, limitations, attacker impacts, and security cautions, visit the Response Modes Reference.

KeyTypeDefaultDescription
modestring"json"Response mode: json, html, text, xml, redirect, captcha, silentDrop, gzipBomb (bomb), tarpit, fakeSuccess (decoy), rateLimitChallenge (ratelimit), proxy (mirror), or infiniteStream (garbagestream).
statusCodeint403HTTP status code returned to client (use 200 for honeypots / deception, 429 for rate limit challenge).
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.
gzipBombMBint10Uncompressed stream size in Megabytes when mode: gzipBomb (expands ~1000x on client memory).
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.

Captcha Options (response.captcha) ​

KeyTypeDefaultDescription
providerstring"turnstile"Captcha provider: turnstile, hcaptcha, or recaptcha.
siteKeystring""Public site key for the captcha widget.
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.

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.