HTTP Headers

HTTP headers are used to transfer all sorts of information between client and server. There are four categories of headers:

General

Information not related to the client, server, or HTTP

Request

Preferred document formats and server parameters

Response

Information about the server sending the response

Entity

Information on the data being sent between the client and server

General headers and entity headers are the same for both the server and client.

All headers in HTTP messages contain the header name followed by a colon (:), then a space, and the value of the header. Header names are case-insensitive (thus, Content-Type is the same as Content-type). The value of a header can extend over multiple lines by preceding each extra line with at least one space or tab character.

General Headers

General headers are used in both client requests and server responses. Some may be more specific to either a client or server message.

Client Request Headers

Client header data communicates the client’s configuration and preferred document formats to the server. Request headers are used in a client message to provide information about the client.

Server Response Headers

The response headers described here are used in server responses to communicate information about the server and how it may handle requests.

Entity Headers

Entity headers are used in both client requests and server responses. They supply information about the entity body in an HTTP message.

Get Webmaster in a Nutshell, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.