What is HTTP status code?

A three-digit number in the first line of an HTTP response that indicates the result of the request. The hundreds digit gives the class: 1xx is informational, 2xx is success (200 OK, 201 Created, 204 No Content), 3xx is redirection (301 Moved Permanently, 302 Found, 304 Not Modified), 4xx is a client error (400 Bad Request, 401 Unauthorized, 403 Forbidden, 404 Not Found) and 5xx is a server error (500 Internal Server Error, 503 Service Unavailable). 401 is used when authentication information is missing or invalid, and 403 when the client is authenticated but lacks permission.

Japanese name: HTTPステータスコード

HTTP status code appears in 3 practice questions across 1 topic, including Web Technology Basics.

Field: Web Technology Basics

Try it: questions about HTTP status code

Which of the following correctly pairs an HTTP status code with its meaning?

  1. A301: The requested resource is temporarily at another URL
  2. B404: The requested resource was not found on the server
  3. C503: The request was malformed and the server could not understand it
Show answer and explanation

Answer: B. 404: The requested resource was not found on the server

A status code is a three-digit number whose hundreds digit indicates its class. 2xx is success (200 OK, 201 Created, 204 No Content), 3xx is redirection (301 Moved Permanently, 302 Found, 304 Not Modified), 4xx is a client error (400 Bad Request, 401 Unauthorized, 403 Forbidden, 404 Not Found) and 5xx is a server error (500 Internal Server Error, 503 Service Unavailable). 404 indicates that the resource identified by the URL was not found on the server.

On a members-only website, an ordinary member who is logged in requests a page that only administrators may access. The server knows who the user is but does not allow access to this page. Which of the following status codes is most appropriate to return?

  1. A401 Unauthorized
  2. B403 Forbidden
  3. C404 Not Found
Show answer and explanation

Answer: B. 403 Forbidden

403 Forbidden indicates that the server understood the request but refuses to allow access. Despite its name, 401 Unauthorized is the code for missing or invalid authentication information, and the WWW-Authenticate header tells the client how to authenticate. Here the server has confirmed who the user is and what is lacking is permission (authorization), so 403 applies. Some designs deliberately return 404 to avoid revealing that an admin page exists, but the code that describes the situation as it is is 403.

HTTP status code in the explanations

Questions that mention HTTP status code (3)

  1. Which of the following correctly pairs an HTTP status code with its meaning?
  2. On a members-only website, an ordinary member who is logged in requests a page that only administrators may access. The server knows who the user is but does not allow access to this page. Which of the following status codes is most appropriate to return?
  3. Which of the following correctly lists the elements in the first line (the request line) of an HTTP/1.1 request?

Books on Web Technology Basics Ad

As an Amazon Associate I earn from qualifying purchases.

Related terms

HTTP (Hypertext Transfer Protocol) Cookie (HTTP cookie) CORS (cross-origin resource sharing) DOM (Document Object Model) Event loop HTTP method JSON (JavaScript Object Notation) JWT (JSON Web Token) OAuth REST API

Back to the glossary