TECHNOLOGY

MLServer request headers: the managed parameters field is not arbitrary payload data

In this article
THE QUICK TAKE

MLServer manages the headers parameter from transport metadata; keep application payload fields, authenticated identity and server-provided context conceptually separate.

A payload field pretends to be request context

A custom runtime reads parameters.headers to select behavior. A developer also adds a same-named field to a JSON fixture and assumes it will arrive unchanged as ordinary application data. The field has framework-managed semantics and must be understood at the transport boundary.

Separate user-authored model input from context inserted by the serving stack. Neither a convenient field name nor its placement inside a parameters object establishes that the information has been authenticated or should control privileged application behavior.

MLServer maps transport metadata explicitly

The custom-runtime guide explains mapping HTTP headers or gRPC metadata into the request parameters headers field. It states that MLServer manages this field and overrides explicitly modified incoming payload values.

Treat that behavior as a protocol mapping, not as an application-specific authorization policy. Real HTTP headers can themselves be supplied by callers unless an authenticated intermediary establishes their provenance and the server enforces that trust boundary.

Model inputs should have their own schema

The content-type guide describes decoding protocol inputs into high-level Python objects. Keep actual model parameters in a documented input or application parameter contract instead of reusing a framework-managed context slot for unrelated data.

Explicit JSON Lines fields provide a related principle: the meaning and ownership of a field are part of its contract. A syntactically valid object is insufficient evidence that a consumer should interpret it as authoritative request context.

Serving configuration is another source of context

The server-settings reference describes server-level configuration. Distinguish deployment configuration, transport metadata and user input when reviewing a runtime’s decision path; they can have different owners and change at different boundaries.

Registry authentication boundaries illustrate the wider distinction between possessing a string and having a verified access context. A runtime should not invent trust merely because the serving framework makes a value convenient to read.

Test through the real transport

Send a controlled request with deliberately different payload and transport values through the actual HTTP or gRPC interface. Observe which context reaches the custom runtime and how the application uses it, without logging sensitive header contents unnecessarily.

Document any trusted intermediary and the fields it is allowed to establish. A correct implementation preserves the managed transport mapping while keeping authorization and model-input semantics explicit, rather than treating every parameters dictionary as unrestricted caller-controlled data or automatic proof of identity.

Earn rental income from GPUs

Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.

Explore GPU hosting
← All articles