Suggest an editImprove this articleRefine the answer for “What are HTTP headers?”. Your changes go to moderation before they’re published.Approval requiredContentWhat you’re changing🇺🇸EN🇺🇦UAPreviewTitle (EN)Short answer (EN)**HTTP headers** are **service information** sent in an HTTP request and HTTP response that helps the client and server understand each other correctly. In simple terms, they are the "explanations" attached to a request or response. **Key point:** headers are not the request body, they do not carry the main data, they control how the transfer behaves.Shown above the full answer for quick recall.Answer (EN)Image**HTTP headers** are **service information** sent **in an HTTP request and HTTP response** that helps the client and server **understand each other correctly**. In simple terms: **HTTP headers are the "explanations" attached to a request or response**. --- ## Why HTTP headers are needed Headers are needed to communicate: - **what data is being sent** - **in what format** - **how to process it** - **who the sender is** - **whether authorization is required** - **whether the response can be cached** Without headers, the server and client would see just a set of bytes and **would not understand their meaning**. --- ## Where HTTP headers are located Headers exist: - in the **HTTP request** - in the **HTTP response** They come: - **after the start line** - **before the message body** --- ## Examples of HTTP headers (simple and important) ### Content-Type Shows **what data is being sent**: - `text/html` - `application/json` - `image/png` The server and client understand **how to interpret the data**. --- ### Authorization Used for **authentication**: - tokens - access keys Tells the server **who is making the request**. --- ### Accept Shows **what data formats the client is willing to accept**: - JSON - HTML - XML --- ### User-Agent Information about the client: - the browser - the operating system - the application --- ### Cache-Control Controls caching: - whether the response can be stored - how long it stays valid --- ## Request headers and response headers ### Request headers Describe: - the client - the request's format - access conditions An example of what they mean: > "I am a browser, I want JSON, here is my token" --- ### Response headers Describe: - the response's data - the format - processing rules An example of what they mean: > "Here is the data, it's JSON, you can cache it for 5 minutes" --- ## What matters for an interview - headers are **not the request body** - they **do not contain the main data** - they control **how the transfer behaves** - one request or response can have **many headers** --- ## Real-life example HTTP headers are like stickers on a package: - "Fragile" - "Handle with care" - "Urgent" - "Where to deliver" The package itself is the **body**, and the stickers are the **headers**. --- ## Short answer for an interview Remember this wording: > **HTTP headers are the service fields of an HTTP request and response that carry meta-information about the data, the client, and the rules for processing the message.**For the reviewerNote to the moderator (optional)Visible only to the moderator. Helps review go faster.