HTTP headers are key-value pairs sent with every HTTP request and response to convey metadata about the communication. They play a critical role in defining how data is handled between client and server.
Common Header Fields 📋
Accept
Specifies the types of content the client is willing to receive. [Learn more about `Accept` headers](/en/http_headers/accept)Content-Type
Indicates the media type of the request/response body. [Explore `Content-Type` examples](/en/http_headers/content_type)User-Agent
Identifies the client's software, OS, and browser. [Check `User-Agent` formats](/en/http_headers/user_agent)Authorization
Contains credentials for server authentication. [Read about security headers](/en/http_headers/security)
Key Concepts 🔍
- Headers are case-insensitive but typically written in lowercase.
- They are separated by CRLF (Carriage Return LineFeed) in raw HTTP.
- Custom headers can be added for specific use cases (e.g.,
X-Requested-With
).
Tools for Inspection 🛠
- Use browser developer tools to view headers in network requests.
- Commands like
curl -I
show headers without the response body. - View a header example to see how they work in practice.
For deeper understanding, check our guide on HTTP methods or request lifecycle.