Skip to content

Commit 484b297

Browse files
committed
feat(cors): 启用默认CORS策略以允许所有来源
- 当CORS未启用时,设置默认策略允许任意来源 - 允许任意HTTP方法通过CORS验证 - 允许任意请求头字段通过CORS验证 - 保留原有的CORS禁用日志信息并扩展说明内容
1 parent c10f50c commit 484b297

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

  • file_classification_webapi/src/bin/utils

file_classification_webapi/src/bin/utils/cors.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@ pub fn create_cors() -> Cors {
3535
.supports_credentials()
3636
.max_age(3600)
3737
} else {
38-
log::info!("CORS 已禁用");
38+
log::info!("CORS 已禁用,允许所有来源");
3939
Cors::default()
40+
.allow_any_origin()
41+
.allow_any_method()
42+
.allow_any_header()
4043
}
4144
}

0 commit comments

Comments
 (0)