HTTP 204 No Content


The HTTP 204 No Content status code indicates that the server successfully processed the request, but is not returning any content.


The HTTP 204 response is typically used to indicate a successful request where no further action is needed from the client, often used in AJAX requests or after DELETE operations in APIs.


Client Behavior:

  1. Send Request: The client sends an HTTP request that does not require a response body.
  2. Receive Response: The client receives the HTTP 204 status code, indicating successful processing with no content to return.

Server Behavior:

  1. Process Request: The server processes the received request.
  2. Send Response: The server sends a 204 No Content response, indicating successful processing without any additional content.


  • AJAX Requests: Used in AJAX operations where the client does not require a new page load or additional content.
  • API DELETE Operations: Commonly returned after successful DELETE requests in RESTful APIs.

Sequence Diagram

A sequence diagram illustrating the request and response flow for HTTP 204:

    participant Client
    participant Server as Web Server

    Note over Client: Client sends a request
    Client->>Server: DELETE /item/123 HTTP/1.1
    Note over Server: Server processes the request
    Server->>Client: HTTP/1.1 204 No Content

Curl Request and Response Example

Sending a DELETE request using Curl and expecting a 204 No Content response:

curl -i -X DELETE
# Expected response: HTTP/1.1 204 No Content

PHP cURL Request and Response Example

PHP code using cURL to send a DELETE request and handle a 204 No Content response:

$ch = curl_init('');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
if (curl_getinfo($ch, CURLINFO_HTTP_CODE) == 204) {
    echo "Item deleted successfully, no content returned.";

Python Request and Response Example

Python script using the requests library to send a DELETE request and check for a 204 No Content response:

import requests
response = requests.delete('')
if response.status_code == 204:
    print("Item deleted successfully, no content returned")

Apache Configuration for HTTP 204 No Content

Configuring Apache to serve resources that might result in a 204 No Content response:

<VirtualHost *:80>
    # Configuration directives...

NGINX Configuration for HTTP 204 No Content

Setting up NGINX to handle DELETE requests that may return a 204 No Content response:

server {
    listen 80;

    location /item {
        # Proxy pass or other directives for DELETE operations
        proxy_pass http://backend_server;
        # Additional configurations...

HTTP 203 Non-Authoritative Information HTTP 205 Reset Content


Free Weekly


Join my weekly newsletter for the latest in tech! You'll get neat coding tricks, trend updates, career advice, SaaS reviews, crypto, bitcoin, and financial tips. All straight to your inbox, designed to keep you ahead.