Print original METHOD /path on auth/api/forward access log entries. Previously the method was not printed, and nothing was printed for 401 without a session.

This commit is contained in:
2026-04-29 15:47:37 +00:00
parent 72d76df35d
commit cde709e252
+10 -1
View File
@@ -203,6 +203,15 @@ async def forward_authentication(
- Otherwise: JSON response with error details and an `iframe` field
pointing to /auth/restricted/iframe#mode=... for iframe-based authentication.
"""
forwarded_method = request.headers.get("x-forwarded-method", "").strip()
forwarded_uri = request.headers.get("x-forwarded-uri", "").strip()
forwarded = (
f"{forwarded_method} {forwarded_uri}"
if forwarded_method and forwarded_uri
else ""
)
_set_log_extra(request, forwarded)
try:
ctx = await authz.verify(
auth,
@@ -210,7 +219,7 @@ async def forward_authentication(
host=request.headers.get("host"),
max_age=max_age,
)
_set_log_extra(request, request.headers.get("x-forwarded-uri", ""), ctx.session.key)
_set_log_extra(request, forwarded, ctx.session.key)
# Build permission scopes for Remote-Groups header
role_permissions = (
{p.scope for p in ctx.permissions} if ctx.permissions else set()