When a Web server responds to an HTTP request, the response typically consists of a status line, some response headers, a blank line, and the document. A typical response looks like this −
HTTP/1.1 200 OK Content-Type: text/html Header2: ... ... HeaderN: ... (Blank Line) <!doctype ...> <html> <head>...</head> <body> ... </body> </html>
The status line consists of the HTTP version (HTTP/1.1 in the example), a status code (200 in the example), and a very short message corresponding to the status code (OK in the example).
Following is a summary of the most useful HTTP 1.1 response headers which go back to the browser from the web server. These headers are frequently used in web programming −
|Sr.No.||Header & Description|
This header specifies the request methods (GET, POST, etc.) that the server supports.
This header specifies the circumstances in which the response document can safely be cached. It can have values public, private or no-cache etc. Public means document is cacheable, Private means document is for a single user and can only be stored in private (nonshared) caches and no-cache means document should never be cached.
This header instructs the browser whether to use persistent HTTP connections or not. A value of close instructs the browser not to use persistent HTTP connections and keep-alive means using persistent connections.
This header lets you request that the browser ask the user to save the response to disk in a file of the given name.
This header specifies the way in which the page was encoded during transmission.
This header signifies the language in which the document is written. For example, en, en-us, ru, etc.
This header indicates the number of bytes in the response. This information is needed only if the browser is using a persistent (keep-alive) HTTP connection.
This header gives the MIME (Multipurpose Internet Mail Extension) type of the response document.
This header specifies the time at which the content should be considered out-of-date and thus no longer be cached.
This header indicates when the document was last changed. The client can then cache the document and supply a date by an If-Modified-Since request header in later requests.
This header should be included with all responses that have a status code in the 300s. This notifies the browser of the document address. The browser automatically reconnects to this location and retrieves the new document.
This header specifies how soon the browser should ask for an updated page. You can specify time in a number of seconds after which a page would be refreshed.
This header can be used in conjunction with a 503 (Service Unavailable) response to tell the client how soon it can repeat its request.
This header specifies a cookie associated with the page.