If-Modified-SinceThu, 28 Sep 2023 03:39:44 GMT
User-AgentCCBot/2.0 (https://commoncrawl.org/faq/)

Browser request headers are a part of the HTTP request that is sent from a web browser to a web server when requesting a web page or other resource. They contain information about the client (the web browser) and the request being made, such as the type of browser being used, the preferred language of the client, and any additional request parameters.

Most used headers with Examples

  1. Accept: This header specifies the MIME types that the client is able to understand. For example: Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8

  2. Accept-Language: This header specifies the languages that the client is able to understand. For example: Accept-Language: en-US,en;q=0.9

  3. Cache-Control: This header specifies caching directives for the request. For example: Cache-Control: no-cache

  4. Connection: This header specifies whether the client or server should keep the connection open after the current request/response cycle is complete. For example: Connection: keep-alive

  5. User-Agent: This header identifies the client software and version, and possibly the client OS, to the server. For example: User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.111 Safari/537.36

  6. Referer: This header specifies the URL of the resource from which the current request was initiated. For example: Referer: https://www.example.com/previous-page.html

  7. Cookie: This header sends cookies from the client to the server. For example: Cookie: sessionid=38afes7a8; csrftoken=b34059d44a

  8. Content-Type: This header specifies the MIME type of the request body. For example: Content-Type: application/x-www-form-urlencoded

  9. Content-Length: This header specifies the size of the request body in bytes. For example: Content-Length: 348

  10. Authorization: This header sends authentication credentials to the server. For example: Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==

Request headers can be viewed and modified using browser developer tools or by using a tool like cURL. They can be useful for debugging and testing web applications, as well as for customizing the behavior of a web server based on the client's preferences or capabilities.

What happens when Browser request to a web server?

When a web browser makes a request to a web server, it sends an HTTP request message to the server. The HTTP request message consists of several parts, including the request line, request headers, and an optional request body.

The request line includes the HTTP method being used (e.g. GET, POST, PUT, DELETE), the URL of the resource being requested, and the version of HTTP being used.

Request headers contain additional information about the request, such as the type and version of the web browser making the request, the preferred language of the client, and any additional request parameters.

The request body is an optional part of the request that can contain data being sent to the server, such as form data or file uploads.

Here is an example of an HTTP request message:

GET /index.html HTTP/1.1 Host: www.example.com User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.182 Safari/537.36 Accept-Language: en-US,en;q=0.9

The first line of the request message (the request line) specifies that the browser is making a GET request for the resource at the URL /index.html using HTTP version 1.1. The remaining lines are request headers that provide additional information about the request.

Upon receiving the request, the web server processes the request and sends an HTTP response message back to the browser, which includes a response status line, response headers, and a response body containing the requested resource or an error message.

By clicking "Accept" or continuing to use our site, you agree to our Website's Privacy Policy