Skip to content

Debug middleware

logger = logging.getLogger(__name__) module-attribute

DebugMiddleware

Middleware for debugging incoming requests.

2024-05-07 -- Used this to see what the ProxyHeaders middleware was seeing when served on DO droplet. Seems like the client host appears to come from one of the DO VPC IPs (172.20.X.X).

always_trust = '*' in self.trusted_hosts instance-attribute

app = app instance-attribute

position = position instance-attribute

trusted_hosts = {item.strip() for item in trusted_hosts.split(',')} instance-attribute

__call__(scope, receive, send) async

__init__(app, position='', trusted_hosts='127.0.0.1')

get_trusted_client_host(x_forwarded_for_hosts)

log(uid, message)