Octopus
1.x
Docs/Octopus/Catalogue
Open

Reading2 min
Updated31 Jul 2026
Sourcev1/middleware/catalogue.mdx

Middleware catalogue

This page catalogues the octopus-middleware implementations that are not wired to gateway configuration or the runtime chain. They are complete, tested Rust middleware reachable only by embedding Octopus as a library — for example via MiddlewareBuilder or by constructing the type directly and adding it with MiddlewareBuilder::with_middleware.

Warning

There is no config key that activates any middleware on this page. The standard gateway binary's chain contains at most compression and the auth gateway. To use anything here you must compose a chain in code — see Using middleware programmatically. CORS and rate limiting have their own pages because they additionally have (unenforced) config schema.

Request context & tracing01

MiddlewareSourceWhat it does
Request IDrequest_id.rsGenerates a request ID (UUID v4 by default) and writes it to a header (default X-Request-ID). Distinct from the proxy's always-on X-Request-ID injection toward upstreams.
Logginglogging.rsStructured request/response access logging.
Audit loggeraudit_logger.rsLogs security-relevant events (auth, access) for compliance/forensics, with configurable output sinks.

Resilience & flow control02

MiddlewareSourceWhat it does
Timeouttimeout.rsCancels a request that exceeds the configured duration (default 30s) and returns 504 Gateway Timeout. Note the live gateway timeout comes from gateway.request_timeout/routes[].timeout applied at the proxy/router, not this middleware.
Retryretry.rsRe-runs the inner chain with exponential backoff on transient failures. The proxy also has its own retry path.
Circuit breakercircuit_breaker.rsPer-upstream Closed → Open → Half-Open breaker using a lock-free map. See the circuit breaker concept.
Deduplicationdeduplication.rsRequest idempotency / dedup of in-flight or repeated requests.
Connection limitsconnection_limits.rsCaps concurrent connections to prevent resource exhaustion.
Request limitsrequest_limits.rsCaps request component sizes (body, headers, URI).
Canarycanary.rsWeighted traffic splitting between upstreams for canary/blue-green rollouts.

Security03

MiddlewareSourceWhat it does
Security headerssecurity_headers.rsAdds hardening headers: Strict-Transport-Security, Content-Security-Policy, X-Frame-Options, X-Content-Type-Options, X-XSS-Protection, Referrer-Policy, Permissions-Policy.
WAFwaf.rsWeb application firewall: detects SQL-injection and XSS patterns. Supports Block and LogOnly modes and configurable targets.
IP filterip_filter.rsAllowlist/blocklist by IP address or CIDR pattern.
Bot detectionbot_detection.rsBlocks or flags requests by User-Agent patterns.
JWTjwt.rsStandalone JWT validation (RS256/HS256/etc.). For gateway auth, prefer the JWT auth provider consumed by the auth gateway rather than this middleware.
Forward authforward_auth.rsDelegates auth to an external subrequest (200 = allow, 401/403 = deny). Also available as an auth provider.

Transformation04

MiddlewareSourceWhat it does
Header transformheader_transform.rsAdd / set / remove / rename headers on requests and responses.
Body transformbody_transform.rsField-level JSON body transforms (remove / rename / set / redact) on JSON payloads.
Redirectredirect.rsRegex path redirects, HTTPS enforcement, and trailing-slash normalization.
Cachingcaching.rsIn-memory response cache keyed by method/path/query/headers, with TTL expiry and FIFO eviction.