Server Responses and Status Codes

The server’s response to a client request is grouped into three parts. The first line is the server response line, which contains the HTTP version number, a three-digit number indicating the status of the request (called a server response code or status code), and a short phrase describing the status. The response line is followed by the header information and an entity body if there is one.

Status codes are typically generated by web servers. However, they can also be generated by CGI scripts that bypass the server’s precooked headers and supply their own. Status codes are grouped as follows:

Code Range Response Meaning
100-199Informational
200-299Client request successful
300-399Client request redirected, further action necessary
400-499Client request incomplete
500-599Server errors

HTTP defines only a few specific codes in each range, although servers may define their own as needed. If a client receives a code it does not recognize, it should understand its basic meaning from its numerical range. While most web browsers handle codes in the 100-, 200-, and 300-range silently, some error codes in the 400- and 500-range are commonly reported back to the user (e.g., “404 Not Found”).

Informational

A response in the range of 100-199 is informational, indicating that the client’s request was received and is being processed.

100 Continue

The initial part of the request has been received and the client may continue with its request.

101 Switching Protocols ...

Get Webmaster in a Nutshell, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.