Skip to content

Response Modes Reference ​

Routewarden features a modular response engine that dictates exactly how reverse proxies (Traefik, Caddy, and NGINX) handle blocked requests. Rather than only offering a generic static 403 error page, Routewarden supports 16 deterministic response modes ranging from standard REST error bodies to interactive bot challenges and offensive honeypot traps.


Response Modes at a Glance ​

ModeCategoryTarget Use CaseDefault Status Code
textStandard ErrorMinimalist plain text response403 Forbidden
jsonStandard ErrorClean REST API error objects for single-page apps403 Forbidden
htmlStandard ErrorBranded corporate or application error pages403 Forbidden
xmlEnterpriseSOAP, XML-RPC, and legacy enterprise backends403 Forbidden
redirectRedirectionExternal honeypots, loopback sinkholes, or portals302 Found
captchaVerificationCloudflare Turnstile, hCaptcha, or Google reCAPTCHA403 Forbidden
silentDropPassive DefenseInstant TCP socket teardown to confuse port scannersN/A (TCP RST/EOF)
gzipBombActive DefenseMemory exhaustion trap that crashes crawler RAM200 OK
tarpitActive DefenseExtremely slow trickle stream to tie up bot sockets200 OK
fakeSuccessDeceptionRealistic fake .env, actuator, git, or phpinfo200 OK
rateLimitChallengeThrottlingHTTP 429 with compliant Retry-After header429 Too Many Requests
proxyForensicsTransparent reverse-proxy into canary honeypot containerUpstream status
infiniteStreamActive DefenseEndless pseudo-random characters to fill crawler storage200 OK
aiPoisonActive DeceptionPrompt injection contamination & synthetic data honeypot200 OK
markovTarpitActive DefensePseudo-coherent word stream trickle to exhaust crawler token windows200 OK
powChallengeVerificationZero-dependency client-side Hashcash challenge solver429 Too Many Requests

1. Plain Text (text) ​

The simplest and lightest mode. Returns a raw text string with Content-Type: text/plain; charset=utf-8 and X-Content-Type-Options: nosniff.

Example Configuration ​

File:
response:  mode: text  statusCode: 403  body: "Access Denied: You do not have permission to view this resource."

Limitations & Caveats ​

  • Browsers render unstyled plain text.
  • Automated API clients that expect JSON will receive an unparsed string.

2. JSON Payload (json) ​

Returns structured JSON data with Content-Type: application/json and X-Content-Type-Options: nosniff. If body is omitted, Routewarden generates a standard JSON error structure containing the HTTP status code and error description.

Example Configuration ​

File:
response:  mode: json  statusCode: 404  body: '{"status":"error","code":404,"message":"The requested endpoint does not exist"}'

Limitations & Caveats ​

  • Ensure body contains valid JSON syntax; Routewarden injects the raw string directly into the HTTP response stream.

3. Custom HTML (html) ​

Renders custom HTML pages with Content-Type: text/html; charset=utf-8. If body is left empty, Routewarden serves a clean minimalist dark-mode fallback page.

Example Configuration ​

File:
response:  mode: html  statusCode: 403  body: |    <!DOCTYPE html>    <html>      <head><title>Access Restricted</title></head>      <body style="font-family: sans-serif; text-align: center; padding: 4rem;">        <h1>403 Restricted Zone</h1>        <p>This endpoint is monitored and protected by Routewarden.</p>      </body>    </html>

4. XML Error (xml) ​

Emits structured XML documents with Content-Type: application/xml; charset=utf-8. Essential for SOAP web services, legacy payment gateways, or enterprise Java/Spring backends where upstream clients fail if returned non-XML payloads.

Example Configuration ​

File:
response:  mode: xml  statusCode: 403  body: |    <?xml version="1.0" encoding="UTF-8"?>    <soap:Fault xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">      <faultcode>soap:Client</faultcode>      <faultstring>Access to protected endpoint is denied</faultstring>    </soap:Fault>

5. URL Redirect (redirect) ​

Redirects the client to another URL using HTTP 301, 302, 307, or 308. If the configured statusCode is outside the 300–308 range, Routewarden automatically falls back to 302 Found. If redirectUrl is omitted, it defaults to /.

Example Configuration ​

File:
response:  mode: redirect  statusCode: 307  redirectUrl: "https://honeypot.corp.example.com/capture"  headers:    X-RouteWarden-Action: "deflected"

Limitations & Caveats ​

  • Advanced scanners detect 30x status codes and record that the endpoint redirected rather than interacting with the destination. For transparent deflection without changing client URLs, use proxy.

6. Interactive Challenge (captcha) ​

Serves a self-contained security verification page prompting users to complete a CAPTCHA challenge before proceeding. Routewarden comes with pre-built dark-mode templates for Cloudflare Turnstile, hCaptcha, and Google reCAPTCHA.

Example Configuration ​

File:
response:  mode: captcha  statusCode: 403  captcha:    provider: turnstile # or "hcaptcha", "recaptcha"    siteKey: "0x4AAAAAAtestkey123"    title: "Routewarden Security Verification"

Limitations & Caveats ​

  • Validating the submitted captcha token on POST requires a backend authentication service or an accompanying Traefik forward-auth plugin. Routewarden serves the challenge interface directly at the edge.

7. Silent TCP Drop (silentDrop) ​

Rather than allocating HTTP response buffers, Routewarden hijacks the underlying TCP connection and terminates it immediately (TCP RST / connection reset) using Go's http.Hijacker.

Example Configuration ​

File:
response:  mode: silentDrop

Why Use Silent Drops? ​

  • Zero Server Bandwidth: No HTTP headers or status codes are sent over the wire.
  • Port Scanner Disruption: Automated scanners (like masscan or nmap) receive an unexpected connection reset, causing them to flag the port or endpoint as dead.

Limitations & Caveats ​

WARNING

Edge Proxies, CDNs, and 502 Bad Gateway: When running behind Cloudflare, AWS ALB, NGINX, Traefik, or any reverse proxy / CDN, closing the TCP socket without an HTTP response causes the upstream proxy to perceive a backend connection failure or dropped peer. The upstream proxy will typically render an HTTP 502 Bad Gateway error to the client.

If you are diagnosing unexpected 502 errors or want predictable error codes delivered through CDNs, use mode json or mode html with statusCode 403 or 404 instead of silentDrop.


8. Gzip Decompression Bomb (gzipBomb / bomb) ​

An active-defense countermeasure. Routewarden serves an HTTP 200 OK response with Content-Encoding: gzip containing a stream of repeating zero-byte blocks.

Example Configuration ​

File:
response:  mode: gzipBomb # Alias: "bomb"  statusCode: 200 # Enticing 200 OK to crawlers  gzipBombMB: 10 # 10MB stream expands to ~10GB in memory

How It Works ​

  1. A 10 MB stream of zeroes compresses into just a few kilobytes over the wire.
  2. Automated crawlers (dirsearch, nikto, gobuster, Python scrapers) automatically decompress HTTP responses in system memory.
  3. Expanding 10 MB to 10+ GB in memory triggers an Out-Of-Memory (OOM) crash in the scanner process or freezes its worker thread pool.

CRITICAL WARNING: Do Not Attach Globally

Standard web browsers and legitimate search engine spiders (Googlebot, Bingbot) automatically decompress gzip encoding.

  • NEVER configure gzipBomb on global entrypoints or legitimate content routes.
  • Always keep enableDefaultAllowPatterns: true so /robots.txt and /sitemap.xml are exempt.
  • Only apply to explicit exploit probe paths (^/\.env, ^/\.git, ^/wp-login\.php, ^/phpmyadmin).

9. Reverse Slowloris Tarpit (tarpit) ​

Stalls the requesting bot's TCP connection by sending an HTTP 200 OK header and trickling individual single bytes at slow, deliberate intervals.

Example Configuration ​

File:
response:  mode: tarpit  statusCode: 200  tarpitDelayMs: 1000 # Send 1 byte every 1000ms (1 second)  tarpitMaxDurationSeconds: 120 # Force connection close after 2 minutes

How It Works & Attacker Impact ​

Automated vulnerability scanners operate with limited thread concurrency pools (typically 10 to 50 threads). When an attacker probes 20 honeypot endpoints, Routewarden holds all 20 worker threads hostage for 120 seconds, grinding their scanning operations to a halt.

Limitations & Traefik Considerations ​

  • Holding open connections consumes an open file descriptor in Traefik. Ensure tarpitMaxDurationSeconds is set to a reasonable limit (e.g. 60–120s) so your Traefik instance does not exhaust connection limits.

10. Synthetic Honeypot Decoy (fakeSuccess / decoy) ​

Feeds automated vulnerability scanners convincing synthetic mock data so they record a false-positive and waste time attempting to exploit dummy credentials.

Example Configuration ​

File:
response:  mode: fakeSuccess # Alias: "decoy"  statusCode: 200

Out-of-the-Box Synthetic Payloads ​

Probed EndpointRoutewarden Synthetic Response Payload
/.envRealistic Laravel .env with dummy MySQL credentials and base64 app key
/actuator/healthSpring Boot Actuator health JSON with dummy disk space metrics
/.git/HEADStandard Git repository pointer (ref: refs/heads/master)
/phpinfo.phpSanitized mock HTML document displaying PHP 8.2 system specs
/wp-login.phpClean WordPress administration login form
Other endpointsGeneric REST success JSON {"status":"success","data":{"id":1,"active":true}}

You can override any synthetic payload by supplying custom text in the body option.


11. Rate Limit Challenge (rateLimitChallenge / ratelimit) ​

Returns an HTTP 429 Too Many Requests status code with an injected standard Retry-After: <seconds> header.

Example Configuration ​

File:
response:  mode: rateLimitChallenge # Aliases: "ratelimit", "backoff"  statusCode: 429  retryAfterSeconds: 300 # Instructs client to wait 5 minutes  body: '{"error":"Too Many Requests","retryAfter":300,"message":"Throttled by Routewarden"}'

Attacker Impact ​

Polite web crawlers, search indexers, and compliance-oriented scrapers respect the Retry-After header and will pause all outbound requests until the cooldown window expires.


12. Transparent Honeypot Proxy (proxy / mirror) ​

Transparently reverse-proxies the unauthorized request into an internal honeypot or forensic capture container (e.g. Cowrie, OpenCanary, or an isolated sandbox) without issuing an HTTP redirect.

Example Configuration ​

File:
response:  mode: proxy # Alias: "mirror"  proxyUrl: "http://canary-honeypot:8080"

Why Use Transparent Proxying? ​

  • Attacker Blindness: Attackers cannot detect that they were redirected because the URL, IP, and TLS handshake remain identical.
  • Forensic Payload Collection: Captures full POST bodies, exploit payloads, SQL injection strings, and evasion attempts inside an isolated environment for security analysis.

13. Infinite Garbage Stream (infiniteStream / garbagestream) ​

Sends an HTTP 200 OK response with Content-Type: application/octet-stream and continuously streams pseudo-random garbage characters at full TCP connection speed.

Example Configuration ​

File:
response:  mode: infiniteStream # Alias: "garbagestream"  statusCode: 200  streamSizeMB: 100 # Stream 100 Megabytes of random data

Attacker Impact ​

  • Fills local disk storage if the crawler saves HTTP response files to disk.
  • Freezes or crashes regex parsers, HTML tokenizers, and JSON decoders that attempt to read the entire body into memory before parsing.

14. Prompt Injection Honeypot (aiPoison / aipoison) ​

Serves an HTTP 200 OK response with X-Robots-Tag: noindex, nofollow, noai, noimageai containing hidden adversarial prompt-injection payloads that instruct Large Language Models and automated retrieval agents (RAG) to purge and disregard scraped content.

Example Configuration ​

File:
response:  mode: aiPoison  statusCode: 200

How It Protects Data ​

  • Synthetic Content Contamination: Injects adversarial instructions invisible to human readers (using display:none; and aria-hidden="true") that direct LLM indexers to treat the domain's contents as synthetic benchmarks or deprecated training data.
  • RAG Defense: Neutralizes real-time knowledge retrieval pipelines by directing model evaluators to ignore and refrain from citing scraped endpoint details.

15. Procedural Word Stream Tarpit (markovTarpit / markovtarpit) ​

Unlike standard byte tarpits that send null bytes or whitespace (which modern scraping HTTP clients often detect as dead sockets), markovTarpit generates and streams pseudo-coherent words at a controlled drip rate (e.g., 500ms intervals).

Example Configuration ​

File:
response:  mode: markovTarpit  statusCode: 200  tarpitDelayMs: 500  tarpitMaxDurationSeconds: 60

Attacker Impact ​

  • Token Window Exhaustion: Forces AI scraper worker threads to continuously allocate context windows and buffers for endless words.
  • Resource Depletion: Prevents timeout detectors from dropping the connection while tying up scraper concurrency pools, with negligible CPU and memory impact on the reverse proxy.

16. Cryptographic Proof-of-Work Challenge (powChallenge / pow / proofOfWork / hashcash) ​

Rather than relying on third-party CAPTCHA widgets that leak telemetry or break headless automated testing, powChallenge serves a zero-dependency, self-contained client-side Hashcash proof-of-work challenge page (<2KB inline HTML/JS) returning HTTP 429 Too Many Requests.

Legitimate human browsers solve the cryptographic puzzle using Web Crypto (crypto.subtle) in 200–800ms, storing an HMAC-signed token cookie (rw_pow) and automatically reloading the page. Unattended crawlers, scrapers, and volumetric botnets without JavaScript execution or willing CPU investment are permanently stopped.

Example Configuration ​

File:
response:  mode: powChallenge  statusCode: 429  powDifficulty: 16  powSecret: "your-cryptographic-pow-secret"  powTimeoutSeconds: 300

Configuration Properties ​

  • powDifficulty (int, default: 16): The required number of leading zero bits in the SHA-256 hash output. Recommended range: 8–24 (validated by audit rule RW-A033). Each increment doubles solver CPU work.
  • powSecret (string, optional): A persistent secret key used to compute HMAC-SHA256 signatures for stateless challenge verification. When omitted, gateways derive an internal process-scoped ephemeral secret.
  • powTimeoutSeconds (int, default: 300): Challenge expiration and solution token validity window in seconds.

How It Protects Data ​

  • Zero Third-Party Dependencies: No external CDN scripts, cookies, or privacy-invasive telemetry. Operates entirely air-gapped within the reverse proxy.
  • Asymmetric Computational Cost: Incurs $O(1)$ server-side verification overhead while forcing scrapers to commit millions of CPU cycles per request.
  • Stateless IP Binding: Challenge tokens are cryptographically bound to the client's normalized IP address (challenge = base64(prefix:difficulty:ip:timestamp:hmac)), preventing token theft and replay across IP pools.
  • Bypass Exemption & Hard Ban Safety: Solving the proof-of-work challenge unlocks protected routes and clears bot suspicion, but honeypot spider traps (robots.txt token traps) and active administrative IP bans remain immutable and strictly blocked.

Released under the MIT License.