10.03.2025

> HTTP Status Codes and Methods

,

The HTTP (HyperText Transfer Protocol) is the backbone of communication on the Internet. It allows a client (such as a web browser) to send requests to a server, and the server returns responses containing HTTP status codes and data. In this post, we’ll break down HTTP status codes and HTTP methods to better understand how requests and responses work online.


What Are HTTP Status Codes?

HTTP status codes are three-digit numbers returned by a server in response to a client request. They indicate whether the request was successful, requires additional action, or failed due to an error. They fall into five main categories:

1xx – Informational Codes

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

  • 100 Continue – The client may continue with the request. Common when sending large payloads and the client checks if the server accepts further data.
  • 101 Switching Protocols – The server agrees to switch protocols (e.g., to WebSockets). Used when the client requests a more efficient communication channel.
  • 103 Early Hints – The server sends preliminary headers before the full response. Mainly used for page load optimization.

2xx – Success

These codes indicate that the request was processed successfully:

  • 200 OK – The request succeeded (e.g. page load). The most common successful response.
  • 201 Created – A resource was successfully created (e.g. after a POST request). Frequently used in APIs.
  • 204 No Content – The request was processed but there’s no content in the response. Often returned after settings updates.
  • 206 Partial Content – The server returns only part of the resource (e.g. chunked file downloads). Used for resumable downloads.

3xx – Redirections

Inform the client that it should refer to another address:

  • 301 Moved Permanently – Permanent redirect to another URL. Common when a page has changed its address.
  • 302 Found – Temporary redirect. Frequently seen in CMS-based websites.
  • 304 Not Modified – The resource hasn’t changed since the last request (cached version can be used). Reduces bandwidth.
  • 307 Temporary Redirect – Temporary redirect while preserving the HTTP method. Unlike 302, the request method isn’t changed.
  • 308 Permanent Redirect – Permanent redirect with the original method preserved. Used when migrating resources.

4xx – Client Errors

These indicate an issue with the client’s request:

  • 400 Bad Request – Malformed or invalid request. Often caused by incorrect syntax.
  • 401 Unauthorized – Missing or invalid authentication. Requires valid credentials (e.g. token).
  • 403 Forbidden – Access denied even with valid authentication.
  • 404 Not Found – Resource not found. May indicate removal or incorrect URL.
  • 405 Method Not Allowed – The HTTP method is not supported for the resource (e.g. POST on a GET-only endpoint).
  • 408 Request Timeout – The server timed out waiting for the request. Can result from slow connections or heavy load.
  • 429 Too Many Requests – Too many attempts in a short time (e.g. API rate limiting). Can indicate abuse or throttling.

5xx – Server Errors

These indicate problems on the server side:

  • 500 Internal Server Error – General server-side failure. Often caused by application errors.
  • 501 Not Implemented – The server doesn’t support the requested HTTP method.
  • 502 Bad Gateway – Communication error between servers. May point to proxy or gateway issues.
  • 503 Service Unavailable – The server is overloaded or under maintenance. Usually temporary, retry later.
  • 504 Gateway Timeout – Upstream server didn’t respond in time. Often caused by unresponsive backend services.
  • 507 Insufficient Storage – The server lacks the space needed to process the request. May require admin intervention.

HTTP Methods – How They Work and Differ

HTTP methods define the type of operation the client wants to perform on the server. Here are the most important ones:

  • GET – Retrieves a resource (e.g. a web page). Does not modify the server’s state.
  • POST – Sends data to the server (e.g. a registration form).
  • PUT – Replaces or updates an existing resource.
  • DELETE – Removes a resource from the server.
  • PATCH – Applies partial updates to a resource (unlike PUT, which replaces it entirely).
  • HEAD – Retrieves only the response headers, not the body (useful for checking availability).
  • OPTIONS – Returns available methods for a specific resource.

Key Differences Between HTTP Methods

  • GET vs POST
    GET retrieves data and should not alter server state; POST sends data and may modify it.
  • PUT vs PATCH
    PUT replaces the entire resource; PATCH applies partial changes.
  • HEAD vs GET
    HEAD works like GET but only returns headers, making it useful for checks without downloading content.

Where to Learn More?

For deeper insights into HTTP, explore:

Understanding HTTP status codes and methods is essential for both developers and IT administrators. With this knowledge, diagnosing web application issues and optimizing client–server communication becomes significantly easier.