Add debug logging

This commit is contained in:
Adam Ladachowski
2026-02-15 23:56:34 +01:00
parent 3dbd72233b
commit 1692789a01
+8 -1
View File
@@ -244,19 +244,26 @@ def _check_auth(comfy_session: str | None, path: str = "", method: str = "GET")
because modulepreload/crossorigin requests don't send cookies. because modulepreload/crossorigin requests don't send cookies.
OPTIONS requests (CORS preflight) are also allowed without auth. OPTIONS requests (CORS preflight) are also allowed without auth.
""" """
import logging
logger = logging.getLogger(__name__)
logger.info(f"_check_auth called: path={path!r}, method={method!r}, has_session={comfy_session is not None}")
if not COMFYUI_USER: if not COMFYUI_USER:
# Auth not configured, allow access logger.info("Auth not configured, allowing")
return return
# Allow CORS preflight requests (they don't send cookies) # Allow CORS preflight requests (they don't send cookies)
if method == "OPTIONS": if method == "OPTIONS":
logger.info("OPTIONS request, allowing")
return return
# Allow static assets without auth (modulepreload doesn't send cookies) # Allow static assets without auth (modulepreload doesn't send cookies)
if path.startswith("assets/"): if path.startswith("assets/"):
logger.info(f"Assets path, allowing: {path}")
return return
if not _verify_session_token(comfy_session): if not _verify_session_token(comfy_session):
logger.info("Invalid session, redirecting to login")
raise HTTPException( raise HTTPException(
status_code=status.HTTP_307_TEMPORARY_REDIRECT, status_code=status.HTTP_307_TEMPORARY_REDIRECT,
headers={"Location": "/comfy/login"}, headers={"Location": "/comfy/login"},