Path: redb-identity/src/redb.Identity.Core/Configuration/ReverseProxyOptions.cs
Snapshot: redb-identity, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages.
License: Apache-2.0. Repository: https://github.com/redbase-app/redb-identity
Page: https://redbase.app/src/dev-2026-12-06/redb-identity/src/redb.Identity.Core/Configuration/ReverseProxyOptions.cs
----
using System.Net;
namespace redb.Identity.Core.Configuration;
///
/// C2 — Configuration for the trusted-reverse-proxy whitelist consulted by
/// .
///
///
/// Secure-by-default: with = false (the default),
/// the resolver ignores all X-Forwarded-For / Forwarded headers and the
/// socket IP carried by redbHttp.RemoteAddress is propagated unchanged. This means
/// per-IP throttling (C1) sees only the immediate TCP peer — correct when the service is
/// exposed directly. Enable forwarded-IP resolution only when the service sits behind a
/// trusted reverse proxy whose IPs are listed here; otherwise an attacker can spoof
/// X-Forwarded-For and bypass per-IP rate limits.
///
public sealed class ReverseProxyOptions
{
///
/// When true, the resolver consults the X-Forwarded-For header on requests
/// arriving from a peer in / , walks
/// the chain right-to-left skipping any further trusted hops, and uses the first untrusted
/// IP as the client address. When false (default), the socket IP is used as-is.
///
public bool TrustForwardedFor { get; set; }
/// Individual IP addresses of trusted reverse proxies.
public List KnownProxies { get; set; } = new();
/// CIDR networks of trusted reverse proxies.
public List KnownNetworks { get; set; } = new();
}