Class ForwardedHeaders
The allow-list of request headers the gateway propagates to a backend on a proxied call, and the filters that apply it.
public static class ForwardedHeaders
- Inheritance
-
ForwardedHeaders
- Inherited Members
Remarks
An allow-list on purpose. Gateway.Invoke/InvokeJson used to snapshot
every inbound header and replay it downstream, which handed the gateway's own
x-api-key — the credential guarding the ingress — to every backend on every
proxied call, crossing the trust boundary that key exists to defend. Backends
authenticate to the gateway with their own key and must never receive the caller's.
Methods
From(Metadata)
Projects inbound gRPC request headers to the subset safe to forward.
public static Dictionary<string, string> From(Metadata headers)
Parameters
headersMetadata
Returns
Remarks
Binary (-bin) entries are skipped rather than read: Value
throws InvalidOperationException on a binary entry, and
Metadata.Add(key, string) throws ArgumentException for a
-bin key. Reading them unconditionally meant any client sending one got an
opaque INTERNAL error and could never use Invoke at all.
IsAllowed(string)
True if header may be forwarded downstream.
public static bool IsAllowed(string header)
Parameters
headerstring