HTTP header
A named line of metadata in an HTTP message, such as Content-Type: application/json, that describes the body, the caller or how to handle the exchange.
In more detail
Header names are case-insensitive and many values are comma-separated lists. Request headers describe the caller and what it accepts; response headers describe the body, caching rules and related links. Look for a standard header before inventing your own, because caches, proxies, browsers and client libraries already understand the standard ones.
Examples
In the browser: Headers control caching, cookies, content types, security policies and CORS.Content-Type, Set-Cookie, traceparent, x-correlation-id, Last-Event-ID, Retry-Afterw.Header().Set("Content-Type", "text/plain")Go: w.Header().Set("Content-Type", "text/plain") before writing the bodyHeaders describe the body's format, caching rules, the target host, authentication and identifiers for tracing a request. Reverse proxies often add headers such as X-Forwarded-For to pass on the original client address. Inspect them alongside the body when diagnosing.Headers carry the caller identity in the course's HTTP labs and switch on browser protections in responses.In this course: Contracts should avoid pinning incidental headers the consumer does not rely on, or they break for no useful reason. Headers are case-insensitive names followed by a value, one per line.Related terms
- HTTP request — The message a client sends to a server: a method, a target, a protocol version, headers, a blank line and an optional body.
- HTTP response — The message a server sends back: a protocol version, a status code and phrase, headers, a blank line and usually a body.
- metadata — Data that describes other data, such as a file name, a creation time or a package version.
- Content-Type — The header that states what format a message body is in, such as application/json.
- HTTP — The protocol web browsers and web servers use to send requests and responses.
- Retry-After — The response header that tells a client how long to wait, in seconds or as a date, before trying again.
- forwarded headers — HTTP headers such as X-Forwarded-For that a proxy adds to tell the app the original client address and scheme.
- Cache-Control — The HTTP header that states the caching policy for a response, such as private, max-age=0 or no-store.
- CORS — The browser rule set that decides whether web page code from one origin may read a response from a different origin.
- Content Security Policy — An HTTP response header that tells the browser which sources of scripts and other content a page may load, limiting what injected markup can do.
- traceparent — The HTTP header defined by Trace Context that carries the trace identifier, parent span identifier and sampling flag between services.
- cookie — A small named value a server asks a browser to store and send back automatically on later matching requests.
- http.ResponseWriter — The Go interface a handler uses to send its response: set headers, write the status code with WriteHeader, then write the body.
- correlation ID — A unique value attached to one request and passed along everywhere it goes, so its logs and traces can be found together.
- Host header — The request header that names the server and port the request is for, such as Host: localhost:8765.
- headers() — The async function from next/headers that returns the incoming request's HTTP headers for reading in Server Components.
- writeHead() — The ServerResponse method that sends the status code and headers of an HTTP response in one go.
- security headers — HTTP response headers that switch on browser protections, such as HSTS for HTTPS-only access and X-Frame-Options against framing.
- deadline propagation — Passing a request's absolute deadline to every service it calls, so each knows how much time is left.
- application layer — The top layer, where protocols such as HTTP, DNS and SSH give the bytes meaning as requests, answers and commands.
- API contract — The written promise an API makes about its operations, inputs, outputs and errors, which callers rely on while the code behind it changes.
- index signature — A type rule such as { [key: string]: string } for objects whose property names are not known in advance.
- authentication — Establishing who a request represents, for example by checking a password, a session cookie or a signed token.
Taught in
- What An API Is, And The Alternatives — Modern API Architecture: REST, GraphQL & gRPC
- Headers And Content Negotiation — Modern API Architecture: REST, GraphQL & gRPC
- Caching And Conditional Requests — Modern API Architecture: REST, GraphQL & gRPC
- The ASP.NET Core Middleware Pipeline — Modern .NET Core, C# & Enterprise Microservices
- Building Routes with Controllers — Modern .NET Core, C# & Enterprise Microservices
- Integration Testing with WebApplicationFactory — Modern .NET Core, C# & Enterprise Microservices
- Client Storage Paradigms: Cookies, Storage Tradeoffs — Frontend Architecture & Web Platform
- Same-Origin Policy, CORS Preflight, Credentials And Headers — Frontend Architecture & Web Platform
- Content Security Policy (CSP), Trusted Types And XSS Defenses — Frontend Architecture & Web Platform
- The Fetch API: Streaming Responses, HTTP Caching And Keepalive — Frontend Architecture & Web Platform
- Type-Safe RPC Architectures: tRPC & Procedures — Production Full-Stack Engineering
- Resilient Error Handling: Problem Details & Envelopes — Production Full-Stack Engineering
- Session Architecture: HTTP-Only Cookies vs Tokens — Production Full-Stack Engineering
- Server-Sent Events: Streaming Updates & Recovery — Production Full-Stack Engineering
- Distributed Tracing: OpenTelemetry & Traceparent — Production Full-Stack Engineering
- Traffic Management: Sliding Window Rate Limiting — Production Full-Stack Engineering
- Serving HTTP with net/http Server — Concurrent Systems Programming with Go
- Reading The Request — Modern Java: Virtual Threads & High-Throughput Services
- Testing APIs With MockMvc — Modern Java: Virtual Threads & High-Throughput Services
- HTTP Is Text: Requests, Status Codes And Headers — Linux Fundamentals & Systems Administration
- Forward And Reverse Proxies — Linux Fundamentals & Systems Administration
- Streaming SSR: Progressive HTML & Chunked Transfers — Next.js 15 & Modern App Router Architecture
- Loading UI: Instant Loading States with loading.tsx — Next.js 15 & Modern App Router Architecture
- Full Route Cache: Static Rendering & Segment Config — Next.js 15 & Modern App Router Architecture
- Streaming Endpoints: Server-Sent Events & NDJSON Feeds — Next.js 15 & Modern App Router Architecture
- Edge Middleware: Auth Verification & Route Matchers — Next.js 15 & Modern App Router Architecture
- Session Management: Secure Cookies & Token Validation — Next.js 15 & Modern App Router Architecture
- Native HTTP Server: Request & Response Lifecycles — Node.js Internals & Backend Services
- Routing & Middleware: Path Parsing & Async Context — Node.js Internals & Backend Services
- Native HTTP/2 Protocols: Multiplexed Streams & Push — Node.js Internals & Backend Services
- Native WebSockets: Bidirectional Real-Time Streams — Node.js Internals & Backend Services
- Traces, Spans And Context Propagation — Full-Stack Observability: Metrics, Tracing & Logging
- Authentication Versus Authorisation — Application Security & Threat Modeling for Engineers
- Broken Object Level Authorization — Application Security & Threat Modeling for Engineers
- Dynamic Scanning — Application Security & Threat Modeling for Engineers
- Load Balancing And The Failure Modes It Introduces — Scalable System Design & Distributed Architecture
- Observability As A Design Input — Scalable System Design & Distributed Architecture
- One Assertion Per Reason — Automated Testing, TDD & Quality Engineering
- Contract Testing Between Services — Automated Testing, TDD & Quality Engineering
- Optional Properties, Readonly And Index Signatures — Production TypeScript