Compare commits

...

1 Commits

Author SHA1 Message Date
Hölting, Moritz (Intern) 9e9a63a700 allow wildcard in cors allowed domains 2025-07-02 12:11:18 +02:00
1 changed files with 7 additions and 1 deletions

View File

@ -63,7 +63,13 @@ async fn main() -> Result<()> {
HttpServer::new(move || {
let cors = allowed_cors
.iter()
.fold(Cors::default(), |cors, domain| cors.allowed_origin(domain))
.fold(Cors::default(), |cors, domain| {
if domain == "*" {
cors.allow_any_origin()
} else {
cors.allowed_origin(domain)
}
})
.send_wildcard()
.allow_any_method()
.allow_any_header()