Skip to content

Commit

Permalink
fix warp cors to allow all origins
Browse files Browse the repository at this point in the history
on upstream warp
  • Loading branch information
jxs committed Aug 21, 2023
1 parent 8bc63a1 commit a410ede
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions common/warp_utils/src/cors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,14 @@ pub fn set_builder_origins(
default_origin: (IpAddr, u16),
) -> Result<Builder, String> {
if let Some(allow_origin) = allow_origin {
let origins = allow_origin
.split(',')
.map(|s| verify_cors_origin_str(s).map(|_| s))
.collect::<Result<Vec<_>, _>>()?;
let mut origins = vec![];
for origin in allow_origin.split(',') {
verify_cors_origin_str(origin)?;
if origin == "*" {
return Ok(builder.allow_any_origin());
}
origins.push(origin)
}
Ok(builder.allow_origins(origins))
} else {
let origin = match default_origin.0 {
Expand Down

0 comments on commit a410ede

Please sign in to comment.