Reputation: 177
In developer.mozilla.org says:
HTTP headers allow the client and the server to pass additional information with the request or the response
but I don't understand what is the use of that? What is the need to pass additional information with the request or the response?
Upvotes: 3
Views: 2317
Reputation: 156
This is a hard question to answer concisely because of the many different types of HTTP headers and what they do, but here's an attempt at a one-line answer:
HTTP headers allow a client and server to understand each other better, meaning they can communicate more effectively.
So then if you look at individual headers, it becomes clearer why each is needed:
User-Agent header
set-cookie header
host header
Upvotes: 6