Limit the number of current request for a certain amount of time for some endpoints.

This commit is contained in:
Greg Burri 2025-03-03 10:10:55 +01:00
parent b2572ebfe5
commit b40ee5f765
4 changed files with 34 additions and 12 deletions

View file

@ -18,6 +18,9 @@ pub const TOKEN_SIZE: usize = 32;
pub const SEND_EMAIL_TIMEOUT: Duration = Duration::from_secs(60);
pub const NUMBER_OF_CONCURRENT_HTTP_REQUEST_FOR_RATE_LIMIT: u64 = 5;
pub const DURATION_FOR_RATE_LIMIT: Duration = Duration::from_secs(5);
// HTTP headers, see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers.
// Common headers can be found in 'axum::http::header' (which is a re-export of the create 'http').
pub const REVERSE_PROXY_IP_HTTP_FIELD: &str = "x-real-ip"; // Set by the reverse proxy (Nginx).