Skip to content

RouteWardenHigh-Performance Edge Defense for Traefik, Caddy & NGINX

Stop sensitive file leaks (.env, .git, backups), neutralize path-evasion attacks, whitelist IPs, and challenge threats before requests reach your upstream services.

RouteWarden Logo

What is RouteWarden? ​

RouteWarden is a security middleware for Traefik, Caddy, and NGINX / OpenResty. It runs at your edge router or ingress controller, evaluating inbound requests and blocking reconnaissance scans before they reach backend application containers.

Internet-connected servers receive continuous automated scans looking for .env files, .git trees, database dumps, backup archives, and administrative interfaces. RouteWarden matches these attempts at the proxy level and responds according to your configuration.


Request Inspection Lifecycle ​

RouteWarden evaluates inbound HTTP requests in five stages:

Stage 1
HTTP Verb Filtering
Checks the request method against configured methods (default: ["GET"]). Non-matching methods bypass inspection immediately.
Stage 2
IP Allowlist Check
Checks client IP against allowedIps via socket RemoteAddr, X-Forwarded-For, or X-Real-IP. Trusted addresses bypass checks immediately.
Stage 3
Anti-Evasion Normalization
Decodes multi-layer percent-encoding (%252e%252e), strips matrix parameters (/;param/.env), normalizes backslashes (\), and removes null bytes.
Stage 4
Rule Evaluation
Evaluates safe exemptions (allowPatterns) first. If not exempted, checks built-in sensitive dictionaries and custom pathPatterns.
Stage 5
Response Generation
Executes the configured response mode: custom JSON, HTML, redirect, silent drop, challenge verification, or gzip compression response.

Default Protection Rules ​

With enableDefaultPatterns: true active, RouteWarden blocks common exposure paths without requiring custom rules:

Environment & Secrets

Blocks /.env, /.env.local, /.env.production, /.aws/credentials, and /.ssh/id_rsa.

Version Control Repositories

Prevents source disclosure via /.git/config, /.git/HEAD, /.svn/entries, and /.hg/.

Database Dumps & Backups

Catches accidental exposure of /dump.sql, /db.bak, /backup.tar.gz, and /site.zip.

Configuration & Debug Files

Guards server manifests like /config.yaml, /app.ini, /phpinfo.php, and Spring /actuator/*.


Anti-Evasion Normalization ​

Attackers often obfuscate request paths to bypass string matching. RouteWarden normalizes paths before evaluation:

Evasion TechniqueRaw Attacker PayloadRouteWarden Normalized CandidateAction
Double URL Encoding/%252e%252e/%252eenv/.envBlocked
Semicolon Matrix Traversal/public;param=1/..;param=2/.env/.envBlocked
Windows / Backslash/static\..\.git\config/.git/configBlocked
Null Byte Injection/.env%00.png/.envBlocked
Dot-Segment Traversal/images/../.aws/credentials/.aws/credentialsBlocked

Response Modes ​

When a path matches a block rule, RouteWarden can respond with:

  • json: Structured JSON payload with customizable status code and body.
  • html: Custom HTML error page.
  • text: Plain text error message.
  • xml: XML-formatted error document.
  • captcha: Human challenge verification using Cloudflare Turnstile, hCaptcha, or Google reCAPTCHA.
  • redirect: HTTP redirect to an external sink or notice page.
  • silentDrop: Immediate TCP connection closure.
  • gzipBomb: Returns a compressed gzip payload that expands in client memory.
  • tarpit: Delivers bytes slowly to hold client connections open.
  • fakeSuccess: Decoy response returning synthetic data with a 200 OK.
  • rateLimitChallenge: Returns HTTP 429 with a standard Retry-After header.
  • proxy: Forwards matching traffic to an internal inspection or canary service.
  • infiniteStream: Continuous stream of pseudorandom data.

30-Second Setup ​

Get protected in seconds with your preferred gateway:

services:
  traefik:
    image: traefik:v3.3
    command:
      - "--experimental.plugins.routewarden.modulename=github.com/routewarden/traefik-warden"
      - "--experimental.plugins.routewarden.version=v1.2.1"
      - "--providers.docker=true"
      - "--entrypoints.web.address=:80"
      - "--entrypoints.web.http.middlewares=warden@docker"
    ports:
      - "80:80"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
    labels:
      - "traefik.enable=true"
      # Global EntryPoint Shield: protects ALL services automatically
      - "traefik.http.middlewares.warden.plugin.routewarden.enabled=true"
      - "traefik.http.middlewares.warden.plugin.routewarden.enableDefaultPatterns=true"

  webapp:
    image: nginx:alpine
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.app.rule=PathPrefix(`/`)"
      - "traefik.http.routers.app.entrypoints=web"

Production Case Studies ​

Real-world deployment patterns demonstrating how engineering teams and self-hosters protect their applications using RouteWarden:

Immich Photo Sharing

Public photo/album sharing while strictly cloaking administrative, login, and user management APIs under a 404.

Zero-Trust Webhooks

Lock down Stripe/GitHub payment webhook ingress using official provider IP CIDRs and silent TCP drops.

Metrics & Actuator Cloaking

Shield Prometheus /metrics and Spring Boot /actuator from public scanners while keeping internal scrapers active.

WordPress & CMS Shield

Defeat brute-force and XML-RPC attacks on wp-login.php using interactive Cloudflare Turnstile / hCaptcha challenges.

Password Vaults (Bitwarden)

Allow public mobile password sync while restricting /admin strictly to WireGuard or Tailscale subnets.

Honeypots & Active Defense

Crash scanning bots with gzipBomb decompression traps, reset TCP connections with silentDrop, and cloak staging preview clusters.

CrowdSec Integration & Auto-Ban

Emit structured JSON security audit events directly into CrowdSec to automatically ban attacker IPs across your firewall on their first request.


Ready to Explore? ​

Released under the MIT License.