HTTP 205 Reset Content

Overview

The HTTP 205 Reset Content status code indicates that the server has successfully processed the request and suggests that the client reset its document view.

Purpose

The HTTP 205 response is typically used to inform the client that it should clear form data or reset the content of the current page, often used after form submissions.

Usage

Client Behavior:

  1. Send Request: The client sends an HTTP request, typically a form submission.
  2. Receive Response: The client receives the HTTP 205 status code, prompting it to reset the current view or form.

Server Behavior:

  1. Process Request: The server processes the request, such as updating data based on a form submission.
  2. Send Response: The server sends a 205 Reset Content response, indicating the client should reset the user interface.

Scenarios

  • Form Submissions: Used in response to form submissions where the server requires the form to be reset after successful submission.
  • User Interface Resets: In scenarios where the server needs the client to reset its user interface, such as clearing input fields.

Sequence Diagram

Illustrating the request and response flow for HTTP 205:

sequenceDiagram
    participant Client
    participant Server as Web Server

    Note over Client: Client submits a form
    Client->>Server: POST /submit-form HTTP/1.1
    Note over Server: Server processes form data
    Server->>Client: HTTP/1.1 205 Reset Content

Curl Request and Response Example

Sending a form submission using Curl that might result in an HTTP 205 response:

curl -i -X POST -d "field1=value1&field2=value2" http://example.com/submit-form
# Expected response: HTTP/1.1 205 Reset Content

PHP cURL Request and Response Example

PHP script using cURL for a form submission where the server might respond with HTTP 205:

<?php
$ch = curl_init('http://example.com/submit-form');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, "field1=value1&field2=value2");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
if (curl_getinfo($ch, CURLINFO_HTTP_CODE) == 205) {
    echo "Form submitted successfully. Client should reset the content.";
}
curl_close($ch);
?>

Python Request and Response Example

Python script to send a POST request and handle a 205 Reset Content response:

import requests
data = {'field1': 'value1', 'field2': 'value2'}
response = requests.post('http://example.com/submit-form', data=data)
if response.status_code == 205:
    print("Form submitted. Client should reset the content.")

Apache Configuration for HTTP 205 Reset Content

Apache configuration for handling requests that may result in a 205 Reset Content response:

<VirtualHost *:80>
    ServerName example.com
    # Configuration directives for form submission endpoints...
</VirtualHost>

NGINX Configuration for HTTP 205 Reset Content

Setting up NGINX to handle requests that could return a 205 Reset Content response:

server {
    listen 80;
    server_name example.com;
    location /submit-form {
        proxy_pass http://backend_server;
        # Additional configurations for handling form submissions
    }
}

HTTP 204 No Content HTTP 206 Partial Content


 

Free Weekly

Newsletter

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.