The 5 Most Important HTTP Headers

That you will need to recognize as a web developer to communicate fluently with a remote API.

Alex Zito

--

For most web developers, a large part of your job will be building pages that interact with and respond to, APIs that are located on a remote server. The more you know about the HTTP protocol, the better you will be able to utilize these API interfaces.

HTTP Headers are key value pairs that let the client (your web application) pass additional information back to the server, and accept the same type of date from the server. This information can be thought of as ‘meta’ information about the request — it does not generally pertain to the payload itself (the body of the request or response) but adds information about the request like it’s source or the authorization of the client request.

Example of HTTP headers in Chrome dev tools

For that reason, there are a number of essential HTTP Headers that you should be familiar with — these will absolutely be important to understand as you get deeper into web development, the question is when you will learn them, not if.

There are some headers that are more commonly seen as responses from the server, called server-side headers, and some that are more commonly sent by the client. I will try to make it clear which type each of these headers is in the list below.

First we’ll look at the 5 headers that you will most often interact with:

  1. Authorization: This client-side header communicates the authorization status of the user. This is a token with the authorization status of the user. It is different from authentication, which is concerned with the actual validation of the user's identity. The authorization header is generally used to send a token that the server can process to determine if the user is allowed to access the given resource.
  2. Content-Type: This client and server-side header tells the recipient of the request what the body of your request contains. For example, is the data type JSON, text, etc... it is incredibly common, but often disregarded because in most cases you will already know the type of data you are expecting to receive.
  3. Accept: This Client-side header determines the data type that you expect to get back from the server…

--

--

Alex Zito

Software Developer + Product Manager. Interested in Travel, Culture, Economics and the Internet. Join Medium: https://tinycode.medium.com/membership