Join our Newsletter — 33% off our NHI Course
Home› Glossary› Cyber Security› Custom Request Header
Cyber Security

Custom Request Header

← Back to Glossary
By NHI Mgmt Group Updated November 3, 2026 Domain: Cyber Security

A custom request header is an HTTP header field defined by an application rather than by the HTTP standard. Web APIs often use them for application-specific metadata, routing, or security checks, and they must be handled consistently by servers, proxies, and browsers because cross-origin requests can trigger preflight handling and header validation.

What a custom request header does

A custom request header lets an application attach its own HTTP metadata to a request, beyond the standard header set defined by the protocol. That makes it useful for signalling application state, request classification, routing hints, tenant context, or security-related attributes, but it also means the header becomes part of the request contract that intermediaries must preserve or intentionally validate.

Because custom headers are not universally understood by browsers, proxies, caches, and API gateways in the same way standard headers are, their behaviour must be designed explicitly. A header that is meaningful at the application layer can be ignored, stripped, normalised, or blocked by another layer if the system does not account for it.

Why custom request headers matter in web APIs

Custom request headers are common in API design because they create a lightweight way to pass metadata without changing the URL or request body. Teams often use them for versioning signals, correlation identifiers, routing decisions, feature flags, partner identifiers, or application-specific security context. The design trade-off is convenience versus interoperability: every extra header becomes another element that must be documented and consistently handled.

When a browser sends a cross-origin request with a non-simple header, the request may trigger CORS preflight processing. That is not just a browser detail, it is part of how the web platform decides whether the target origin will accept the method, headers, and credentials involved in the request. If the server’s policy does not explicitly allow the header, the browser will block the request before the application ever sees it.

How custom headers interact with cross-origin and intermediary controls

Custom headers become especially important where origin trust boundaries matter. A server may rely on them for request classification or security decisions, but those decisions only hold if the header is received exactly as expected and is not forged by an untrusted client. In practice, that means the application should treat the header as input, not as proof, unless the surrounding trust model genuinely makes it trustworthy.

Intermediaries can also change the meaning of a custom header. Reverse proxies may drop headers they are not configured to pass through, caches may vary incorrectly if the header is omitted from cache keys, and upstream services may interpret the same name differently. A robust design needs an explicit contract for naming, forwarding, normalisation, and allowed values so the header does not create a hidden dependency between layers.

For broader guidance on using request metadata to separate trusted from untrusted cross-site traffic, see the Fetch Metadata and Resource Isolation Policy Guide. It explains how Sec-Fetch-* headers support request isolation decisions and why servers should validate them as part of a defence-in-depth policy.

Operational implications for design, validation, and debugging

Custom request headers are easiest to maintain when they are treated as part of the API specification, not as an implementation convenience. Their names, allowed values, trust assumptions, and proxy behaviour should be documented so developers, gateway rules, and browser clients stay aligned. That reduces brittle behaviour where one layer depends on a header that another layer never forwards or accepts.

They also complicate debugging because failures can appear at several different points: the client may never send the header, the browser may preflight and reject the request, the gateway may remove it, or the application may read a value that looks valid but does not match the expected context. When headers drive security checks, those failure modes should be considered part of the control design rather than treated as incidental bugs.

Risk and Threat Considerations

Custom request headers can create exposure when an application treats them as authoritative without enforcing where they came from. An attacker may try to forge a header that influences routing, access checks, tenant selection, or request handling, especially if the application assumes that a browser, proxy, or gateway has already validated it.

Failure mechanism: The header is accepted as trusted context even though the client can supply it directly or an intermediary can alter or remove it, which can bypass intended request isolation or security logic.

Impact: That can lead to authorization mistakes, incorrect routing, cache poisoning, policy bypass, or information disclosure when the wrong request context is applied.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

OWASP API Security Top 10 addresses the attack and risk surface, while NIST SP 800-53 Rev 5 and OWASP ASVS set the governance and control requirements practitioners need to meet.

FrameworkControl / ReferenceRelevance
OWASP API Security Top 10API8 — Security MisconfigurationCustom headers are often accepted, forwarded, or blocked incorrectly across API layers.
Recommendation — Validate custom-header handling across gateways, browsers, and services to prevent misconfiguration-driven bypasses.
NIST SP 800-53 Rev 5AC-4 — Information Flow EnforcementHeader-driven routing and policy checks control information flow between request sources and services.
IA-5 — Authenticator ManagementWhen custom headers carry security tokens or context, their lifecycle and protection become part of credential handling.
SC-23 — Session AuthenticityHeader-based context can be abused if requests are not bound to their authentic origin and session context.
Recommendation — Enforce request-path and header-based flow rules so untrusted clients cannot steer protected processing. Protect and rotate any secret-bearing header values with the same discipline used for other authenticators. Bind request handling to verified session and origin context before trusting custom header metadata.
OWASP ASVSV4 — API and Web ServiceAPI headers are part of service contract handling, cross-origin behavior, and server-side request validation.
Recommendation — Specify and test custom header acceptance, validation, and cross-origin handling in API security verification.

Practitioner Guidance

Why practitioners should care: A custom header is only safe when its meaning is stable across every component that touches the request. If the value affects security, origin decisions, or backend selection, define who sets it, who may modify it, and what happens when it is missing or unexpected.

Common misunderstanding: Teams often assume that a header added by a frontend or gateway is automatically trustworthy. In reality, any client-controlled header must be validated against the actual trust boundary, and any security decision based on it should fail closed when the expected context is absent.

Practitioner takeaway: Design custom headers as explicit contract fields, with documented forwarding rules and validation logic, rather than as informal metadata that different layers interpret differently.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

NHIMG Editorial Note
Reviewed and updated by the NHIMG editorial team on November 3, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org