HTTP 499 Client Closed Request (Nginx)
Overview
The HTTP 499 Client Closed Request
status code is specific to Nginx and indicates that the client closed the connection before the server could respond. This status is often seen when a client terminates the request prematurely.
Purpose
The HTTP 499 response is used to inform that the client closed the connection, and the server did not have the opportunity to send a complete response.
Usage
Client Behavior:
- Send Request: The client sends an HTTP request to the server.
- Close Connection: The client closes the connection before receiving a complete response.
Server Behavior:
- Processing Request: The server processes the request.
- Connection Closed: The client closes the connection before the server completes the response.
- Send Response: The server sends a
499 Client Closed Request
response to indicate the premature connection closure.
Scenarios
- User Interruption: The user navigates away or interrupts the request before completion.
- Network Issues: Connection issues result in the client closing the request prematurely.
Sequence Diagram
Illustrating the process for an HTTP 499 response:
sequenceDiagram participant Client participant Server as Nginx Note over Client: Client initiates a request Client->>Server: GET /resource HTTP/1.1 Note over Server: Server processes the request Server-->>Client: 499 Client Closed Request
Curl Request and Response Example
Sending a request with Curl and closing the connection:
curl -i http://example.com/resource
# Expected response: HTTP/1.1 499 Client Closed Request
PHP cURL Request and Response Example
PHP script using cURL to simulate a client closing the connection:
<?php
$ch = curl_init('http://example.com/resource');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_exec($ch);
// Simulate client closing the connection
curl_close($ch);
?>
Python Request and Response Example
Python script to send a request and simulate a client closing the connection:
import requests
response = requests.get('http://example.com/resource')
# Simulate client closing the connection
response.connection.close()
Apache Configuration for HTTP 499 Client Closed Request (Nginx)
Nginx typically handles the 499 status code automatically without additional configuration.
NGINX Configuration for HTTP 499 Client Closed Request
No specific configuration is required for NGINX to handle the 499 status code, as it is automatically generated when the client closes the request prematurely.
HTTP 451 Unavailable For Legal Reasons HTTP 500 Internal Server Error