我正在用actix web构建REST API.如何配置CORS以接受来自任何来源的请求?
Cors::new() // <- Construct CORS middleware builder
.allowed_origin("localhost:8081")
.allowed_methods(vec!["GET", "POST"])
.allowed_headers(vec![http::header::AUTHORIZATION, http::header::ACCEPT])
.allowed_header(http::header::CONTENT_TYPE)
.max_age(3600)
上面的代码在localhost:8081
的网络上运行,但在0.0.0.0:8081
或127.0.0.1:8081
的网络上不起作用.我试着允许所有人,但不起作用.我如何允许全部,或者至少允许一个特定的来源,然后传递多个URL?