0% found this document useful (0 votes)
10 views5 pages

HTTP - Status Codes

Uploaded by

Vikash Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views5 pages

HTTP - Status Codes

Uploaded by

Vikash Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Page 1 of 5

HTTP - Status Codes


The Status-Code element in a server response, is a 3-digit integer where the first digit of the
Status-Code defines the class of response and the last two digits do not have any
categorization role. There are 5 values for the first digit:

Status Code Description

1xx:
It means the request has been received and the process is continuing.
Informational

It means the action was successfully received, understood, and


2xx: Success
accepted.

3xx: Redirection It means further action must be taken in order to complete the request.

4xx: Client Error It means the request contains incorrect syntax or cannot be fulfilled.

5xx: Server Error It means the server failed to fulfill an apparently valid request.

HTTP status codes are extensible and HTTP applications are not required to understand the
meaning of all the registered status codes. Given below is a list of all the status codes.

1xx: Information

Message Description

Only a part of the request has been received by the server, but as long as
100 Continue
it has not been rejected, the client should continue with the request.

101 Switching
The server switches protocol.
Protocols

2xx: Successful

Message Description

200 OK The request is OK.

201 Created The request is complete, and a new resource is created.

The request is accepted for processing, but the processing is not


202 Accepted
complete.
Page 2 of 5

203 Non-
The information in the entity header is from a local or third-party copy,
authoritative
not from the original server.
Information

A status code and a header are given in the response, but there is no
204 No Content
entity-body in the reply.

The browser should clear the form used for this transaction for
205 Reset Content
additional input.

The server is returning partial data of the size requested. Used in


206 Partial response to a request specifying a Range header. The server must
Content specify the range included in the response with the Content-Range
header.

Example

GET /index.htm HTTP/1.1


User-Agent: Mozilla/4.0
Host: www.tutorialspoint.com
Accept-Language: en-us
Accept-Encoding: gzip, deflate
Connection: Keep-Alive

The server response against the above GET request will be as follows:

HTTP/1.1 200 OK
Date: Tue, 16 Dec 2024 18:59:38 GMT
Server: Apache/2.4.59 (Ubuntu)
Vary: Accept-Encoding,Origin
Content-Length: 20241
Content-Type: text/html; charset=UTF-8

Explore our latest online courses and learn new skills at your own pace. Enroll and become a
certified expert to boost your career.

3xx: Redirection

Message Description

300 Multiple A link list. The user can select a link and go to that location. Maximum
Choices five addresses.
Page 3 of 5

301 Moved
The requested page has moved to a new url.
Permanently

302 Found The requested page has moved temporarily to a new url.

303 See Other The requested page can be found under a different url.

This is the response code to an If-Modified-Since or If-None-Match


304 Not Modified
header, where the URL has not been modified since the specified date.

The requested URL must be accessed through the proxy mentioned in


305 Use Proxy
the Location header.

This code was used in a previous version. It is no longer used, but the
306 Unused
code is reserved.

307 Temporary
The requested page has moved temporarily to a new url.
Redirect

Example

GET httpbin.org/redirect/1 HTTP/1.1

The server response against the above GET request will be as follows:

HTTP/1.1 302 FOUND


Date: Tue, 17 Dec 2024 07:55:56 GMT
Content-Type: text/html; charset=utf-8
Content-Length: 215
Server: gunicorn/19.9.0

4xx: Client Error

Message Description

400Bad Request The server did not understand the request.

401 Unauthorized The requested page needs a username and a password.

402 Payment Required You can not use this code yet.

403 Forbidden Access is forbidden to the requested page.

404 Not Found The server can not find the requested page.
Page 4 of 5

405 Method Not


The method specified in the request is not allowed.
Allowed

The server can only generate a response that is not accepted by


406 Not Acceptable
the client.

407 Proxy
You must authenticate with a proxy server before this request can
Authentication
be served.
Required

408 Request Timeout The request took longer than the server was prepared to wait.

409 Conflict The request could not be completed because of a conflict.

410 Gone The requested page is no longer available.

The "Content-Length" is not defined. The server will not accept the
411 Length Required
request without it.

412 Precondition The pre condition given in the request evaluated to false by the
Failed server.

413 Request Entity Too The server will not accept the request, because the request entity is
Large too large.

The server will not accept the request, because the url is too long.
414 Request-url Too
Occurs when you convert a "post" request to a "get" request with a
Long
long query information.

415 Unsupported The server will not accept the request, because the mediatype is
Media Type not supported.

416 Requested Range


The requested byte range is not available and is out of bounds.
Not Satisfiable

The expectation given in an Expect request-header field could not


417 Expectation Failed
be met by this server.

Example

GET httpbin.org/post HTTP/1.1

The server response against the above GET request will be as follows:

HTTP/1.1 405 METHOD NOT ALLOWED


Date: Tue, 17 Dec 2024 07:58:43 GMT
Page 5 of 5

Content-Type: text/html
Content-Length: 178
Server: gunicorn/19.9.0
Allow: POST, OPTIONS

5xx: Server Error

Message Description

The request was not completed. The server met an unexpected


500Internal Server Error
condition.

The request was not completed. The server did not support the
501 Not Implemented
functionality required.

The request was not completed. The server received an invalid


502 Bad Gateway
response from the upstream server.

The request was not completed. The server is temporarily


503 Service Unavailable
overloading or down.

504 Gateway Timeout The gateway has timed out.

505 HTTP Version Not


The server does not support the "http protocol" version.
Supported

Example

GET httpbin.org/status/500 HTTP/1.1

The server response against the above GET request will be as follows:

HTTP/1.1 500 INTERNAL SERVER ERROR


Date: Tue, 17 Dec 2024 08:05:12 GMT
Content-Type: text/html; charset=utf-8
Content-Length: 0
Server: gunicorn/19.9.0

You might also like