mirror of https://github.com/Mai-with-u/MaiBot.git
feat: 增强 Cookie 设置日志,提供 HTTPS 配置建议
parent
a5880522e7
commit
48f2d1c33c
|
|
@ -108,7 +108,12 @@ def set_auth_cookie(response: Response, token: str, request: Optional[Request] =
|
||||||
|
|
||||||
# 如果是 HTTP 连接,强制禁用 secure 标志
|
# 如果是 HTTP 连接,强制禁用 secure 标志
|
||||||
if not is_https and is_secure:
|
if not is_https and is_secure:
|
||||||
logger.warning("检测到 HTTP 连接但配置要求 secure cookie,强制禁用 secure 以允许 cookie 工作")
|
logger.warning("=" * 80)
|
||||||
|
logger.warning("检测到 HTTP 连接但环境配置要求 HTTPS (secure cookie)")
|
||||||
|
logger.warning("已自动禁用 secure 标志以允许登录,但建议修改配置:")
|
||||||
|
logger.warning("1. 在 .env 文件中设置: WEBUI_SECURE_COOKIE=false")
|
||||||
|
logger.warning("2. 如果使用反向代理,请确保正确配置 X-Forwarded-Proto 头")
|
||||||
|
logger.warning("=" * 80)
|
||||||
is_secure = False
|
is_secure = False
|
||||||
|
|
||||||
# 设置 Cookie
|
# 设置 Cookie
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue