Custom middleware

The runtime pipeline (Router → Security → Bind → Validate → OperationHandler → Responder) lives behind a single http.Handler. Standard ecosystem middleware — compression, logging, rate-limiting, tracing — composes around that handler the usual way. Order matters: transport-level concerns (TLS termination, auth gating, rate limits) typically wrap whatever middleware needs to see the final response bytes (compression, logging), which in turn wraps the runtime pipeline.

The pages below cover specific compositions worth pinning down.

  • Adding transparent HTTP response compression (gzip, brotli, …) to a runtime server by wrapping the http.Handler returned by middleware.Serve with the CAFxX httpcompression adapter.