DEV Community

Sanawar78
Sanawar78

Posted on

HTTP REQUEST AND RESPONSE HEADERS

HTTP stands for "Hyper text transfer protocol". HTTP headers are the code that transfer data between a web server and client. HTTP headers are mainly intended for the communication between the server and client in both direction.

HTTP Request Headers
The client sends the request to the server to fetch some data or information. Basically, the client request is an HTTP Request, which communicates between the client and the server. Moreover, it is a simple text file formatted in either XML or JSON, which send the client binary data to the server.

  • Host request header defines the host and port number of the server to which request is sent.
  • User-Agent is a request header that allows to identify the operating system and Browser of web-server.
  • Connection controls the network connection.
  • Cache-control specifies browser caching policies.
  • The Proxy-Authorization request header field allows the client to identify itself or its user.

Alt Text

HTTP Response Headers
HTTP response header is a component of network packet that is sent by a web server to a web browser or client machine in response to an HTTP Request.

  • HTTP response status codes that is sent to a client in the form of three- digit number after successfully completed. Responses are grouped in five classes:

    1. The range (100-199) is classed as Informational.
    2. The range (200-299) is classed as Successful.
    3. The range (300-399) is classed as Redirection.
    4. The range (400-499) is classed as Client error.
    5. The range (500-599) is classed as Server error.
  • A content-type header tells the client what the content type of the returned content actually is.

  • Set-Cookie in which response header send cookie from server to the user. Cookies are mainly used for session management

  • The Content-Length indicates the size of the message body, in bytes sent to the user.

Alt Text

Top comments (0)