HTTP 499 Client Closed Request is a non-standard status code used by nginx to indicate the client closed the connection before the server finished responding. This commonly occurs when: users navigate away before a page loads, API clients time out waiting for a response, load balancers close idle connections, or mobile users lose network connectivity. While not part of any RFC, 499 appears frequently in nginx access logs and monitoring dashboards.
Response includes the status code, standard headers (including Content-Type), and a small diagnostic JSON body describing the request and returned status.
Simulator URL (copy in the app after load — not a normal link):
https://httpstatus.com/api/status/499
Example request:
curl -i "https://httpstatus.com/api/status/499"The client closed the connection before the server could send a response (non-standard, used by nginx).
On this code, Inspector focuses on semantics, headers, and correctness warnings that commonly affect clients and caches.
HTTP 499 Client Closed Request has specific technical implications for API design, caching, and client behavior. Understanding the precise semantics helps distinguish it from similar status codes and implement correct error handling. The response should include a descriptive body following a consistent error schema (like RFC 7807 Problem Details) so clients can programmatically handle the error.
// Handle 499 Client Closed Request in Express
app.use((err, req, res, next) => {
if (err.status === 499) {
return res.status(499).json({
type: 'https://api.example.com/errors/client-closed-request',
title: 'Client Closed Request',
status: 499,
detail: err.message
});
}
next(err);
});from fastapi import HTTPException
# Raise 499 Client Closed Request
raise HTTPException(
status_code=499,
detail={
'type': 'client_closed_request',
'message': 'Descriptive error for 499 Client Closed Request'
}
)// Spring Boot 499 Client Closed Request handling
@ExceptionHandler(CustomClientClosedRequestException.class)
public ResponseEntity<ErrorResponse> handleClientClosedRequest(
CustomClientClosedRequestException ex) {
return ResponseEntity.status(499)
.body(new ErrorResponse("Client Closed Request", ex.getMessage()));
}// Return 499 Client Closed Request
func errorHandler(w http.ResponseWriter, message string) {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(499)
json.NewEncoder(w).Encode(map[string]any{
"status": 499,
"error": "Client Closed Request",
"message": message,
})
}