Module layer

Source
Expand description

Http Layers provided by Rama.

A Layer, as defined in rama_core::Service, is a middleware that can modify the request and/or response of a Services. It is also capable of branching between two or more Services.

Examples:

  • auth: A layer that can be used to authenticate requests, branching in case the request is not authenticated (read: rejected).
  • cors: A layer that can be used to add CORS headers to the response.

Most layers are implemented as a Service, and then wrapped in a Layer. This is done to allow the layer to be used as a service, and to allow it to be composed with other layers.

Modules§

auth
Authorization related middleware.
body_limit
Apply a limit to the request body.
catch_panic
Convert panics into responses.
classify
Tools for classifying responses as either success or failure.
collect_body
Collect the http Body
compressioncompression
Middleware that compresses response bodies.
cors
Middleware which adds headers for CORS.
decompressioncompression
Middleware that decompresses request and response bodies.
dns
Layers in function of DNS.
error_handling
Middleware to turn Service errors into Responses.
follow_redirect
Middleware for following redirections.
forwarded
Middleware to support the reading and writing of Forwarded headers.
header_config
Extract a header config from a request or response and insert it into the Extensions of its Context.
header_option_value
Similar to super::header_config::HeaderConfigLayer, but storing the Default value of type T in case the header with the given HeaderName is present and has a bool-like value.
map_request_body
Apply a transformation to the request body.
map_response_body
Apply a transformation to the response body.
normalize_path
Middleware that normalizes paths.
opentelemetrytelemetry
Http OpenTelemetry Layer Support for Rama.
propagate_headers
Propagate a header from the request to the response.
proxy_auth
Middleware that validates if a request has the appropriate Proxy Authorisation.
remove_header
Middleware for removing headers from requests and responses.
request_id
Set and propagate request ids.
required_header
Middleware for setting required headers on requests and responses, if they are missing.
retry
Middleware for retrying “failed” requests.
sensitive_headers
Middlewares that mark headers as sensitive.
set_header
Middleware for setting headers on requests and responses.
set_status
Middleware to override status codes.
timeout
Middleware that applies a timeout to requests.
trace
Middleware that adds high level tracing to a Service.
traffic_writer
Middleware to write Http traffic in std format.
ua
User-Agent (see also rama-ua) http layer support
validate_request
Middleware that validates requests.