HTTP 203 Non-Authoritative Information

Overview

The HTTP 203 Non-Authoritative Information status code indicates that the server successfully processed the request, but the returned metadata may not be from the origin server.

Purpose

The HTTP 203 response is used to convey that the returned payload has been modified by an intermediary, such as a proxy server, and may not exactly represent the original server’s response.

Usage

Client Behavior:

  1. Send Request: The client sends an HTTP request.
  2. Receive Response: The client receives the HTTP 203 status code, indicating the response may have been altered.

Server Behavior:

  1. Process Request: The server or intermediary processes the request.
  2. Send Response: The server or intermediary sends a 203 Non-Authoritative Information response, possibly altering the original content.

Scenarios

  • Proxy Server Responses: Common in environments where proxy servers modify the original response for various reasons, like adding annotations or altering headers.
  • Cached Responses: When a cached response is served and modified by an intermediary before reaching the client.

Sequence Diagram

A sequence diagram to illustrate the request and response process for HTTP 203:

sequenceDiagram
    participant Client
    participant Proxy as Proxy Server
    participant Origin as Origin Server

    Client->>Proxy: GET /resource HTTP/1.1
    Proxy->>Origin: GET /resource HTTP/1.1
    Origin->>Proxy: HTTP/1.1 200 OK
    Proxy->>Client: HTTP/1.1 203 Non-Authoritative Information

Curl Request and Response Example

Sending a request with Curl and expecting a potential 203 Non-Authoritative Information response:

curl -i http://example.com/resource
# Possible response: HTTP/1.1 203 Non-Authoritative Information

PHP cURL Request and Response Example

PHP code using cURL to send a request where the response might be modified by an intermediary:

<?php
$ch = curl_init('http://example.com/resource');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
if (curl_getinfo($ch, CURLINFO_HTTP_CODE) == 203) {
    echo "Response might have been modified by an intermediary.";
}
curl_close($ch);
?>

Python Request and Response Example

Python script using the requests library for a request that could receive a 203 Non-Authoritative Information response:

import requests
response = requests.get('http://example.com/resource')
if response.status_code == 203:
    print("Response might have been modified by an intermediary")

Apache Configuration for HTTP 203 Non-Authoritative Information

Configuring Apache for environments where intermediary modifications might lead to a 203 response:

<VirtualHost *:80>
    ServerName proxy.example.com
    # Configurations for proxy behavior...
</VirtualHost>

NGINX Configuration for HTTP 203 Non-Authoritative Information

Setting up NGINX in a proxy environment where responses might be modified:

server {
    listen 80;
    server_name proxy.example.com;
    location / {
        proxy_pass http://backend_server;
        # Additional proxy configurations...
    }
}

HTTP 202 Accepted HTTP 204 No 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.