This commit is contained in:
Robin Appelman 2024-11-29 18:58:08 +01:00
commit 6f3a1977bc
3 changed files with 35 additions and 5 deletions

View file

@ -1,10 +1,6 @@
//! Get the "real-ip" of an incoming request.
//!
//! This uses the "forwarded", "x-forwarded-for" or "x-real-ip" headers set by reverse proxies.
//! To stop clients from abusing these headers, only headers set by trusted remotes will be accepted.
//!
//! Note that if multiple forwarded-for addresses are present, which can be the case when using nested reverse proxies,
//! all proxies in the chain have to be within the list of trusted proxies.
//!
//! ## Trusted proxies
//!
@ -13,6 +9,9 @@
//!
//! Trusted proxies are configured as a list of [`IpNetwork`]s, which can be a single ip or an ip range.
//!
//! Note that if multiple forwarded-for addresses are present, which can be the case when using nested reverse proxies,
//! all proxies in the chain have to be within the list of trusted proxies.
//!
//! ## Examples
//!
//! A request originating from 192.0.2.1, being proxied through 10.10.10.10 and 10.0.0.1 before reaching our program
@ -169,3 +168,7 @@ fn maybe_bracketed(x: &str) -> &str {
x
}
}
#[allow(dead_code)]
#[doc = include_str!("../README.md")]
fn test_readme_examples() {}