更新 app.py: 修改 CORS 配置,限制允许的来源为特定 IP 和本地地址,并启用支持凭证功能。

This commit is contained in:
2025-07-19 20:39:51 +08:00
parent 1ec32cba7c
commit 8d2ced4221

View File

@ -92,7 +92,7 @@ def create_app():
app.get_db = get_db app.get_db = get_db
# 启用 CORS跨域支持 # 启用 CORS跨域支持
CORS(app, resources={r"/*": {"origins": "*"}}) # 允许所有来源或指定局域网IP CORS(app, resources={r"/*": {"origins": ["http://203.195.163.42:7792", "http://localhost:5000"]}}, supports_credentials=True)
# 注册蓝图 # 注册蓝图
from blueprints.login import bp as login_bp from blueprints.login import bp as login_bp