This article briefly summarizes the HTTP request headers and response headers, and uses the response headers in some web development cases.
1. HTTP request Header
Accept: The browser uses this header to tell the server what type of data it supports. such as: text/html, Image/jpeg
Accept-charset: The browser tells the server through this header which character set it supports.
Accept-encoding: The browser tells the server through this header which compression format it supports.
Accept-language: The browser tells the server through this header, its locale.
Host: The browser tells the server through this header which host it wants to access.
If-modified-since: The browser tells the server through this header that the time to cache the data
Referer: The browser tells the server through this header which page the client is on (anti-theft chain).
Connection: The browser tells the server through this header whether to disconnect or maintain the link after the request is completed.
2. HTTP response Header
Location: The server tells the browser where to jump through this header.
Server: This header tells the browser server the model number.
Content-encoding: The server tells the browser the compression format of the data through this header.
Content-length: The server tells the browser the length of the loopback data through this header.
Content-language: The server tells the browser locale through this header.
Content-type: The server tells the browser the type of the loopback data through this header.
Refresh: The server tells the browser to refresh periodically through this header.
Content-disposition: The server uses this header to tell the browser to open the data in the following way.
Transfer-encoding: The server uses this header to tell the browser that data is being echoed back in chunks.
The following three indicates that the server tells the browser not to cache through this header
Expires:-1
Cache-control:no-cache
Pragma:no-cache
3. HTTP Response Status Code
100-199: Indicates a successful receive request, requiring the client to continue submitting the next request in order to complete the process
200-299: Indicates a successful receive request and has completed the entire process, commonly used 200
300-399: The request is not completed, the customer needs further refinement of the request, commonly used 302,307,304
400-499: Client request has errors, common 404
500-599: Error on server side, common 500
HTTP request headers and Response headers