Header fields (usually just called ‘headers’) may be added to an HTTP request to provide additional information with the request. A header has semantics similar to parameters passed to a method in any programming language that supports such things.
A request with
Referer headers might look like this:
GET /search HTTP/1.1 \r\n Host: google.com \r\n User-Agent: Chrome/54.0.2803.1 \r\n Referer: http://google.com/ \r\n \r\n
A full list of supported HTTP 1.1 request headers can be found in the specification. The most common are:
Host- the host name part of the request URL (required in HTTP/1.1)
User-Agent- a string that represents the user agent requesting;
Referer- the URI that the client was referred here from; and
If-Modified-Since- gives a date that the server can use to determine if a resource has changed and indicate that the client can used a cached copy if it has not.
A header should be formed as
Name: Value CRLF.
Name is the header name, such as
Value is the data assigned to it, and the line should end with a CRLF. Header names are case-insensitive and may only use letters, digits and the characters
!#$%&'*+-.^_`|~ (RFC7230 section 3.2.6 Field value components).
Referer header field name is a typo for ‘referrer’, introduced accidentally in RFC1945.