allowed_hosts#

class litestar.middleware.allowed_hosts.AllowedHostsMiddleware#

Bases: AbstractMiddleware

Middleware ensuring the host of a request originated in a trusted host.

__init__(app: ASGIApp, config: AllowedHostsConfig) None#

Initialize AllowedHostsMiddleware.

Parameters:
  • app – The next ASGI app to call.

  • config – An instance of AllowedHostsConfig.