HTTP HTTP responses Additional Headers


Example

Like an HTTP request, an HTTP response may include additional headers to modify or augment the response it provides.

A full list of available headers is defined in ยง6.2 of the specification. The most commonly-used headers are:

  • Server, which functions like a User-Agent request header for the server;
  • Location, which is used on 201 and 3xx status responses to indicate a URI to redirect to; and
  • ETag, which is a unique identifier for this version of the returned resource to enable clients to cache the response.

Response headers come after the status line, and as with request headers are formed as such:

Name: Value CRLF

Name provides the header name, such as ETag or Location, and Value provides the value that the server is setting for that header. The line ends with a CRLF.

A response with headers might look like this:

HTTP/1.1 201 Created \r\n
Server: WEBrick/1.3.1 \r\n
Location: http://example.com/files/129742 \r\n