Skip to content

Commit

Permalink
fix(labrinth): cors headers on ratelimited (#3189)
Browse files Browse the repository at this point in the history
Kinda hotfix.

Fixes #2591
Fixes #2529
  • Loading branch information
Erb3 authored Jan 30, 2025
1 parent 9180f5c commit a5427f7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions apps/labrinth/src/util/cors.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use actix_cors::Cors;

// Updating this? Remember to update the ratelimit CORS too!
pub fn default_cors() -> Cors {
Cors::default()
.allow_any_origin()
Expand Down
9 changes: 9 additions & 0 deletions apps/labrinth/src/util/ratelimit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,15 @@ where
wait_time.as_secs().into(),
);

// TODO: Sentralize CORS in the CORS util.
headers.insert(
actix_web::http::header::HeaderName::from_str(
"Access-Control-Allow-Origin",
)
.unwrap(),
"*".parse().unwrap(),
);

Box::pin(async {
Ok(req.into_response(response.map_into_right_body()))
})
Expand Down

0 comments on commit a5427f7

Please sign in to comment.