#[non_exhaustive]pub struct ForwardConfig {
pub x_forwarded_for: XForwardedFor,
pub client_header: Option<String>,
pub audit_header: Option<String>,
}Expand description
What the upstream (and the fallback) receives of the client’s address.
The defaults give an upstream nothing a client can forge: a verified
X-Forwarded-For whose first element is the client, and the address in
X-Real-IP. Every header named here is written by the proxy alone; a
guard (JWT claim headers, ext_authz, the auth decider) cannot set it.
| Behind | Setting |
|---|---|
nginx, $proxy_add_x_forwarded_for and X-Real-IP | x_forwarded_for: append, client_header: x-real-ip |
Envoy, use_remote_address | append, client_header: x-envoy-external-address |
HAProxy, option forwardfor | append |
AWS ALB append / preserve / remove | the mode of the same name |
| Cloudflare | append, client_header: cf-connecting-ip |
| Traefik, Caddy | verified (stricter), or append |
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.x_forwarded_for: XForwardedForWhat X-Forwarded-For carries upstream.
client_header: Option<String>The header the resolved address is written to, replacing any value
the request carried; absent when no address resolved. None (null
in YAML) writes none. A text gRPC metadata key (not ending in -bin)
other than x-forwarded-for and forwarded. Default: x-real-ip.
audit_header: Option<String>A header receiving the X-Forwarded-For field lines exactly as the
request carried them, before any change: for logs and audits only,
since nothing in it is verified. Off by default. A text gRPC metadata
key (not ending in -bin) other than x-forwarded-for, x-real-ip,
forwarded and client_header, e.g. x-original-forwarded-for.
Trait Implementations§
Source§impl Clone for ForwardConfig
impl Clone for ForwardConfig
Source§impl Debug for ForwardConfig
impl Debug for ForwardConfig
Source§impl Default for ForwardConfig
impl Default for ForwardConfig
Source§impl<'de> Deserialize<'de> for ForwardConfig
impl<'de> Deserialize<'de> for ForwardConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for ForwardConfig
impl RefUnwindSafe for ForwardConfig
impl Send for ForwardConfig
impl Sync for ForwardConfig
impl Unpin for ForwardConfig
impl UnsafeUnpin for ForwardConfig
impl UnwindSafe for ForwardConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request