scoped cors

This commit is contained in:
realaravinth
2021-04-12 10:25:52 +05:30
parent bbf182a918
commit c776092023
4 changed files with 38 additions and 15 deletions

View File

@@ -81,12 +81,12 @@ async fn main() -> std::io::Result<()> {
HttpServer::new(move || {
let client = Client::default();
let captcha_api_cors = Cors::default()
.allow_any_origin()
.allowed_methods(vec!["POST"])
.allow_any_header()
.max_age(0)
.send_wildcard();
// let captcha_api_cors = Cors::default()
// .allow_any_origin()
// .allowed_methods(vec!["POST"])
// .allow_any_header()
// .max_age(0)
// .send_wildcard();
App::new()
.wrap(middleware::Logger::default())
@@ -97,12 +97,13 @@ async fn main() -> std::io::Result<()> {
.wrap(middleware::NormalizePath::new(
middleware::normalize::TrailingSlash::Trim,
))
.configure(v1::pow::services)
.configure(v1::services)
.service(
scope("/api/v1/pow")
.wrap(captcha_api_cors)
.configure(v1::pow::services),
)
//.service(
// scope("/")
// .wrap(captcha_api_cors)
// .configure(v1::pow::services),
//)
.configure(docs::services)
.configure(templates::services)
.configure(static_assets::services)