Headers and representations
Request headers
Read common request headers that identify the target host, client preferences, body format, authorization, and previous page.
8 minute lesson
Request headers add context to a request.
GET /articles HTTP/1.1
Host: example.com
Accept: text/html
Accept-Language: en
User-Agent: Mozilla/5.0 ...
Host identifies the requested hostname. This lets one server address host several websites.
Accept and Accept-Language describe formats and languages the client can handle. Content-Type describes a body the client is sending.
Authorization carries credentials such as a bearer token. Cookie carries cookies that match the URL. Referer can identify the page that led to the request, subject to browser policy.
Headers are not automatically trustworthy. A custom client can send a fake User-Agent, Referer, or forwarding header. Use cryptographic verification and trusted infrastructure for security decisions.
Lesson completed