API

class oslo_middleware.CatchErrors(application)

Middleware that provides high-level error handling.

It catches all exceptions from subsequent applications in WSGI pipeline to hide internal errors from API response.

class oslo_middleware.CorrelationId(application)

Middleware that attaches a correlation id to WSGI request

class oslo_middleware.CORS(application, conf)

CORS Middleware.

This middleware allows a WSGI app to serve CORS headers for multiple configured domains.

For more information, see http://www.w3.org/TR/cors/

class oslo_middleware.Debug(application)

Helper class that returns debug information.

Can be inserted into any WSGI application chain to get information about the request and response.

static print_generator(app_iter)

Prints the contents of a wrapper string iterator when iterated.

class oslo_middleware.Healthcheck(application, conf)

Healthcheck middleware used for monitoring.

If the path is /healthcheck, it will respond 200 with “OK” as the body. Or 503 with the reason as the body if one of the backend report an application issue.

Example of paste configuration:

[filter:healthcheck]
paste.filter_factory = oslo_middleware:Healthcheck.factory
path = /healthcheck
backends = disable_by_file
disable_by_file_path = /var/run/nova/healthcheck_disable

[pipeline:public_api]
pipeline = healthcheck sizelimit [...] public_service

Multiple filter sections can be defined if it desired to have pipelines with different healthcheck configuration, example:

[pipeline:public_api]
pipeline = healthcheck_public sizelimit [...] public_service

[pipeline:admin_api]
pipeline = healthcheck_admin sizelimit [...] admin_service

[filter:healthcheck_public]
paste.filter_factory = oslo_middleware:Healthcheck.factory
path = /healthcheck_public
backends = disable_by_file
disable_by_file_path = /var/run/nova/healthcheck_public_disable

[filter:healthcheck_admin]
paste.filter_factory = oslo_middleware:Healthcheck.factory
path = /healthcheck_admin
backends = disable_by_file
disable_by_file_path = /var/run/nova/healthcheck_admin_disable

More details on available backends and their configuration can be found on this page: Healthcheck middleware plugins.

classmethod factory(global_conf, **local_conf)

Factory method for paste.deploy.

class oslo_middleware.RequestId(application)

Middleware that ensures request ID.

It ensures to assign request ID for each API request and set it to request environment. The request ID is also added to API response.

class oslo_middleware.RequestBodySizeLimiter(application)

Limit the size of incoming requests.

Previous topic

Installation

Next topic

Healthcheck middleware plugins

This Page