Skip to content

Request Pipeline

The pipeline module defines the ordered middleware execution sequence and specialized HTTP governance policies. It evaluates incoming requests against load shedding thresholds, CORS preflight standards, trace context propagators, and security isolation guards. The pipeline operates as a deterministic bidirectional onion model wrapping the upstream forwarder.

SymbolKindSignaturePurpose
AuditEventinterfaceinterface AuditEventInterface export for AuditEvent.
AuditPolicyConfiginterfaceinterface AuditPolicyConfigInterface export for AuditPolicyConfig.
AuditPolicyclassclass AuditPolicy implements GatewayPolicyClass export for AuditPolicy.
CorsConfiginterfaceinterface CorsConfigInterface export for CorsConfig.
CorsPolicyclassclass CorsPolicy implements GatewayPolicyClass export for CorsPolicy.
ProblemFieldsinterfaceinterface ProblemFieldsInterface export for ProblemFields.
ProblemDetailsinterfaceinterface ProblemDetailsInterface export for ProblemDetails.
createProblemfunctionfunction createProblem(code: string, fields: ProblemFields = {}): ResponseFunction export for createProblem.
problemToJsonfunctionfunction problemToJson(problem: ProblemDetails): stringFunction export for problemToJson.
HttpProblemsconstconst HttpProblems =Const export for HttpProblems.
IdempotencyConfiginterfaceinterface IdempotencyConfigInterface export for IdempotencyConfig.
IdempotencyPolicyclassclass IdempotencyPolicy implements GatewayPolicyClass export for IdempotencyPolicy.
LoadShedPolicyclassclass LoadShedPolicy implements GatewayPolicyClass export for LoadShedPolicy.
OutboundResponseinterfaceinterface OutboundResponseInterface export for OutboundResponse.
GatewayPolicyinterfaceinterface GatewayPolicyInterface export for GatewayPolicy.
PluginPolicyclassclass PluginPolicy implements GatewayPolicyClass export for PluginPolicy.
isPluginfunctionfunction isPlugin(value: unknown): value is PluginFunction export for isPlugin.
RecordPolicyConfiginterfaceinterface RecordPolicyConfigInterface export for RecordPolicyConfig.
RecordPolicyclassclass RecordPolicy implements GatewayPolicyClass export for RecordPolicy.
RecordedExchangeinterfaceinterface RecordedExchangeInterface export for RecordedExchange.
RecordStoreclassclass RecordStoreClass export for RecordStore.
ReplayPolicyConfiginterfaceinterface ReplayPolicyConfigInterface export for ReplayPolicyConfig.
ReplayPolicyclassclass ReplayPolicy implements GatewayPolicyClass export for ReplayPolicy.
RequestPipelineclassclass RequestPipelineClass export for RequestPipeline.
SecretMaskConfiginterfaceinterface SecretMaskConfigInterface export for SecretMaskConfig.
SecretMaskPolicyclassclass SecretMaskPolicy implements GatewayPolicyClass export for SecretMaskPolicy.
SecurityHeadersConfiginterfaceinterface SecurityHeadersConfigInterface export for SecurityHeadersConfig.
SecurityHeadersPolicyclassclass SecurityHeadersPolicy implements GatewayPolicyClass export for SecurityHeadersPolicy.
ShadowPolicyConfiginterfaceinterface ShadowPolicyConfigInterface export for ShadowPolicyConfig.
ShadowStatsinterfaceinterface ShadowStatsInterface export for ShadowStats.
ShadowPolicyclassclass ShadowPolicy implements GatewayPolicyClass export for ShadowPolicy.
SsrfGuardConfiginterfaceinterface SsrfGuardConfigInterface export for SsrfGuardConfig.
isPrivateHostfunctionfunction isPrivateHost(host: string, opts: { blockLinkLocal: boolean }): booleanFunction export for isPrivateHost.
SsrfGuardPolicyclassclass SsrfGuardPolicy implements GatewayPolicyClass export for SsrfGuardPolicy.
StickySessionConfiginterfaceinterface StickySessionConfigInterface export for StickySessionConfig.
StickySessionPolicyclassclass StickySessionPolicy implements GatewayPolicyClass export for StickySessionPolicy.
TraceContextPolicyclassclass TraceContextPolicy implements GatewayPolicyClass export for TraceContextPolicy.

Executes registered policies in strict phase order: pre-routing, authentication, transformation, and upstream execution.

Standardizes RFC 7807 and RFC 9457 error payloads across all short-circuited policies.

Monitors P95 latency and sheds excess traffic with 503 Problem Details when system headroom is exhausted.

  • src/pipeline/audit-policy.ts
  • src/pipeline/cors-policy.ts
  • src/pipeline/http-problems.ts
  • src/pipeline/idempotency-policy.ts
  • src/pipeline/load-shed-policy.ts
  • src/pipeline/policy.ts
  • src/pipeline/record-policy.ts
  • src/pipeline/record-store.ts
  • src/pipeline/replay-policy.ts
  • src/pipeline/request-pipeline.ts
  • src/pipeline/secret-mask-policy.ts
  • src/pipeline/security-headers-policy.ts
  • src/pipeline/shadow-policy.ts
  • src/pipeline/ssrf-guard-policy.ts
  • src/pipeline/sticky-session-policy.ts
  • src/pipeline/trace-context-policy.ts