Path: redb-route/redb.Route.Http/HttpHeaders.cs
Snapshot: redb-route, 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-route
Page: https://redbase.app/src/dev-2026-12-06/redb-route/redb.Route.Http/HttpHeaders.cs
----
namespace redb.Route.Http;
///
/// Well-known header constants used by the HTTP component.
/// Exchange headers with the "redbHttp." prefix are set/read automatically.
/// Standard HTTP headers (Content-Type, Authorization, etc.) are bridged as-is.
///
public static class HttpHeaders
{
/// Common prefix for all HTTP component headers.
public const string Prefix = "redbHttp.";
/// HTTP response status code (int). Set by producer after response, by consumer in Out message.
public const string StatusCode = "redbHttp.StatusCode";
/// HTTP response reason phrase.
public const string StatusText = "redbHttp.StatusText";
/// The full request/response URL.
public const string Url = "redbHttp.Url";
/// HTTP method used (GET, POST, etc.).
public const string Method = "redbHttp.Method";
/// HTTP Content-Type header value.
public const string ContentType = "Content-Type";
/// HTTP Content-Length header value.
public const string ContentLength = "Content-Length";
/// Query string from the incoming request (consumer). Example: "param1=val1¶m2=val2".
public const string Query = "redbHttp.Query";
/// Raw request path (consumer). Example: "/webhook".
public const string Path = "redbHttp.Path";
/// Remote IP address of the client (consumer).
public const string RemoteAddress = "redbHttp.RemoteAddress";
/// Server port the request was received on (consumer).
public const string Port = "redbHttp.Port";
/// Response content type override. If set, producer/consumer use this for response Content-Type.
public const string ResponseContentType = "redbHttp.ResponseContentType";
/// Response status code override. If set as int, consumer uses this for response status code.
public const string ResponseCode = "redbHttp.ResponseCode";
/// Authorization header value.
public const string Authorization = "Authorization";
/// Accept header value.
public const string Accept = "Accept";
/// User-Agent header value.
public const string UserAgent = "User-Agent";
/// Prefix for route template parameters. Example: "redbHttp.RouteParam.id".
public const string RouteParamPrefix = "redbHttp.RouteParam.";
/// Prefix for query string parameters. Example: "redbHttp.QueryParam.sort".
public const string QueryParamPrefix = "redbHttp.QueryParam.";
// ── What is never carried, and what the default strategy keeps back ──
///
/// The control headers of this component — the request it builds and the exchange a consumer fills. The default
/// strategy of a producer () does not send them as request headers; a
/// consumer never takes a received redbHttp.* header and never answers with one.
///
public static readonly IReadOnlySet ControlHeaders = new HashSet(StringComparer.OrdinalIgnoreCase)
{
StatusCode, StatusText, Url, Method, Query, Path, RemoteAddress, Port,
ResponseContentType, ResponseCode,
};
///
/// Fields of the protocol, never carried between an exchange and a message whatever the header filter strategy
/// says: the hop-by-hop fields, Host (only preserveHostHeader=true carries the original one) and the
/// content fields, which describe the body and are set from it.
///
public static readonly IReadOnlySet ProtocolHeaders = new HashSet(StringComparer.OrdinalIgnoreCase)
{
// Hop-by-hop HTTP headers
"Connection", "Keep-Alive", "Transfer-Encoding", "TE",
"Trailer", "Upgrade", "Proxy-Authorization", "Proxy-Authenticate",
// Host names THIS hop's target. Bridging it verbatim turned every proxy route into an
// accidental preserve-host proxy; the explicit preserveHostHeader=true is the one way
// to carry the original through (the options sweep).
"Host",
// Content headers managed by HttpClient
ContentType, ContentLength, "Content-Encoding", "Content-Language",
"Content-Disposition", "Content-Range"
};
///
/// Fields only a response carries (RFC 9110 §10.2 and §11, RFC 6265 Set-Cookie). A consumer drops them from an
/// inbound request before the exchange is built, so neither the route nor the response ever holds a value a client
/// planted under a response field's name. Stricter than Camel's inbound filter, which removes only its own
/// Camel* headers: a request has no legitimate use for these, and one that sends them is probing.
///
public static readonly IReadOnlySet ResponseOnlyHeaders = new HashSet(StringComparer.OrdinalIgnoreCase)
{
"Set-Cookie", "Location", "WWW-Authenticate", "Proxy-Authenticate", "Authentication-Info",
"Proxy-Authentication-Info", "Retry-After", "Server", "Age", "ETag", "Accept-Ranges", "Vary",
};
/// Returns true if the header key belongs to the HTTP component (starts with "redbHttp.").
public static bool IsRedbHeader(string key) =>
key.StartsWith(Prefix, StringComparison.OrdinalIgnoreCase);
}