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

Understand how MLServer maps HTTP headers or gRPC metadata into managed request parameters, and why a caller-authored payload field cannot be treated as trusted transport context.

Author: Retrivium editorial team
Updated: 2026-11-04
Canonical URL: https://retrivium.ai/journal/fg2-mlserver-managed-headers-payload-transport-metadata/
Language: en

## 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](https://docs.seldon.ai/mlserver/user-guide/custom) 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](https://docs.seldon.ai/mlserver/user-guide/content-type) 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](/journal/data-guide-jsonlines-explicit-schema/) 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](https://docs.seldon.ai/mlserver/api-reference/settings) 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](/journal/kubernetes-imagepullbackoff-registry-auth/) 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.
