Types of HTTP Status code.

Types of HTTP Status code.

In server responses, HTTP status codes are used to indicate the outcome of a client's request to the server. These status codes are divided into five main categories, each represented by the first digit of the three-digit code. Here's a breakdown of these categories and some common status codes:


1. 1xx: Informational

These codes indicate that the server has received the request and is continuing to process it.

- 100 Continue: The server has received the initial part of the request and the client should continue sending the rest.

- 101 Switching Protocols: The server is switching protocols as requested by the client.


2. 2xx: Success

These codes indicate that the client's request was successfully received, understood, and accepted.

- 200 OK: The request was successful, and the server has returned the requested resource.

- 201 Created: The request was successful, and a new resource has been created as a result.

- 202 Accepted: The request has been accepted for processing, but the processing has not been completed.

- 204 No Content: The server successfully processed the request, but there is no content to send in the response.


3. 3xx: Redirection

These codes indicate that further action needs to be taken by the client to complete the request.

- 301 Moved Permanently: The requested resource has been permanently moved to a new location.

- 302 Found: The requested resource is temporarily available at a different URI.

- 304 Not Modified: The resource has not been modified since the last request, so the client can use the cached version.


4. 4xx: Client Error

These codes indicate that there was an error in the request sent by the client.

- 400 Bad Request: The server cannot process the request due to a client error (e.g., malformed request syntax).

- 401 Unauthorized: The request requires user authentication.

- 403 Forbidden: The server understands the request but refuses to authorize it.

- 404 Not Found: The requested resource could not be found on the server.

- 405 Method Not Allowed: The request method is not supported for the requested resource.


5. 5xx: Server Error

These codes indicate that the server failed to fulfill a valid request.

- 500 Internal Server Error: A generic error occurred on the server.

- 501 Not Implemented: The server does not recognize the request method, or it lacks the ability to fulfill the request.

- 502 Bad Gateway: The server, acting as a gateway or proxy, received an invalid response from the upstream server.

- 503 Service Unavailable: The server is currently unable to handle the request due to temporary overloading or maintenance.

These status codes help communicate the result of the request to the client, providing information on whether the request was successful, requires further action, or encountered errors.

要查看或添加评论,请登录

Towhidul Islam的更多文章

  • The Future of AI Powered Web Solutions: What Businesses Need to Know

    The Future of AI Powered Web Solutions: What Businesses Need to Know

    Artificial Intelligence is transforming the digital landscape, redefining how businesses interact with customers…

    5 条评论
  • Difference ways to create an Object following OOP:

    Difference ways to create an Object following OOP:

    In JavaScript, object creation in Object-Oriented Programming (OOP) can be in several ways. Here are some common…

  • Setting Up Nginx for Your Domain on Ubuntu

    Setting Up Nginx for Your Domain on Ubuntu

    Setting Up Nginx for Your Domain on Ubuntu This guide will walk you through the process of installing Nginx on an…

  • JavaScript Closures: A Detailed Explanation

    JavaScript Closures: A Detailed Explanation

    What is a Closure? A closure is a feature in JavaScript where an inner function has access to its own scope, the outer…

  • Recursion

    Recursion

    Recursion Recursion is the technique of making a function call itself. This technique provides a way to break…

  • Virtualization.

    Virtualization.

    Virtualization is a technology that enables the creation of virtual instances of physical hardware, operating systems…

  • Time complexity.

    Time complexity.

    Imagine a classroom of 100 students in which you gave your pen to one person. You have to find that pen without knowing…

  • ls -l

    ls -l

    towhidul@towhidul-Aspire-V5-471G:~$ ls -l total 36 drwxr-xr-x 2 towhidul towhidul 4096 Feb 25 16:59 Desktop drwxr-xr-x…

  • Linux Command Line Basics

    Linux Command Line Basics

    Lab Environment Setup One can use an online bash interpreter to run all the commands that are provided as examples in…

  • React Component

    React Component

    React components are an integral part of building user interfaces with React, and they indeed make developers' lives…

社区洞察

其他会员也浏览了