What are HTTP Headers for -- and how do they work?
Using the Hypertext Transfer Protocol (HTTP), browsers can communicate with web servers to get information to load web pages. When an HTTP request is made, and an HTTP response is given by a web server, the request or response is usually accompanied by additional information, contained in an HTTP header. The additional information in the HTTP header helps ensure that the data pulled from the web server can be properly displayed in the browser window. In addition to the Content-Type
header, the request includes diagnostic information, such as:
When a browser performs a "GET" request, it sends details about the request in the HTTP request header. Here's an example of an HTTP request header from a browser's "GET request to bunny.net's website:
Request URL: https://bunny.net/
Request Method: GET
Status Code: 200
Remote Address: <server_IP>:443
Referrer Policy: strict-origin-when-cross-origin
Just like HTTP request headers, HTTP response headers also contain details about the responses, such as content type, HTTP status code, and character encoding. If you use a CDN, like bunny.net, the response headers also show information related to the CDN. Below is an example of a HTTP response header from bunny.net’s website:
cache-control: public, max-age=30
cdn-cache: HIT
cdn-cachedat: <cache_date>
cdn-edgestorageid: <edge_storage_id>
cdn-proxyver: 1.0
cdn-pullzone: <pullzone_id>
cdn-requestcountrycode: <country_code>
cdn-requestid: <request_id>
cdn-requestpullcode: 200
cdn-requestpullsuccess: True
cdn-status: 200
cdn-uid: <uid>
content-encoding: br
content-type: text/html; charset=utf-8
date: <date>
server: BunnyCDN-<node_id>
vary: Accept-Encoding
Hypertext Transfer Protocol. A protocol that connects web browsers to web servers when they request content.
A series of 3-digit numbers that represent the results of HTTP requests and responses.
The part of an HTTP message that contains information about the contents of the message.