Files
kefu/deploy/mobile-http-20260928/payload-diff.txt
T
2026-09-29 15:52:07 +08:00

28 lines
1.5 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
--- production/wechat_rpa/remote_api.py
+++ release/wechat_rpa/remote_api.py
@@ -79,15 +79,17 @@
def https_required(request: Request) -> bool:
- """手机端要在公网上提交 ZYT 密码,明文 HTTP 只允许在内网试用。
-
- MOBILE_REQUIRE_HTTPS:auto(默认,公网地址必须 HTTPS)/ always / never。
-
- 没有 X-Real-IP 时按"来源不明"处理:生产环境里直连 API 的对端是 Docker 网桥
- (172.x,看起来像内网),代理漏配头就会把公网请求误当内网放行。只有本机回环
+ """手机端登录是否必须走 HTTPS。
+
+ MOBILE_REQUIRE_HTTPS:never(默认,内外网都允许明文 HTTP 登录,按用户要求)/
+ auto(公网地址必须 HTTPS,内网可用 HTTP)/ always。配好 HTTPS 入口后建议改成
+ auto:明文 HTTP 下 ZYT 密码和手机会话令牌在公网上可被截获。
+
+ auto 模式下没有 X-Real-IP 时按"来源不明"处理:生产环境里直连 API 的对端是 Docker
+ 网桥(172.x,看起来像内网),代理漏配头就会把公网请求误当内网放行。只有本机回环
(开发时直接访问 127.0.0.1)才在没有这个头时被信任。
"""
- policy = os.environ.get("MOBILE_REQUIRE_HTTPS", "auto").strip().lower()
+ policy = os.environ.get("MOBILE_REQUIRE_HTTPS", "never").strip().lower()
if policy == "never" or request_scheme(request) == "https":
return False
if policy == "always":