Skip to content

Commit

Permalink
Bump
Browse files Browse the repository at this point in the history
  • Loading branch information
lucemans committed Dec 19, 2024
1 parent 2115d60 commit c070366
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions server/src/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,19 @@ async fn rate_limit_middleware(
) -> Result<Response, StatusCode> {
let ip = req
.headers()
.get("x-forwarded-for")
.get("CF-Connecting-IP")
.and_then(|hv| hv.to_str().ok())
.unwrap_or("unknown")
.unwrap_or_else(|| {
req.headers()
.get("x-real-ip")
.and_then(|hv| hv.to_str().ok())
.unwrap_or_else(|| {
req.headers()
.get("x-forwarded-for")
.and_then(|hv| hv.to_str().ok())
.unwrap_or("unknown")
})
})
.to_string();

let path = req
Expand Down

0 comments on commit c070366

Please sign in to comment.