From b6e95b5ea150e6d232e4bb41b33677dcd5b7f543 Mon Sep 17 00:00:00 2001 From: Giovanni Barillari Date: Wed, 29 Oct 2025 19:09:07 +0100 Subject: [PATCH] Update `PATH_INFO` when prefix is configured in wsgi (#722) --- granian/wsgi.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/granian/wsgi.py b/granian/wsgi.py index 5b62a9e..79586f1 100644 --- a/granian/wsgi.py +++ b/granian/wsgi.py @@ -48,6 +48,9 @@ def _callback_wrapper(callback: Callable[..., Any], scope_opts: Dict[str, Any], def _runner(proto, scope): resp = Response() scope.update(basic_env) + if scope['SCRIPT_NAME']: + scope['PATH_INFO'] = scope['PATH_INFO'][len(scope['SCRIPT_NAME']) :] or '/' + rv = callback(scope, resp) if isinstance(rv, list):