HTTP 407 Proxy Authentication Required is the proxy equivalent of 401 Unauthorized. It indicates the client must authenticate with an intermediate proxy server before the request can proceed to the destination. The proxy MUST include a Proxy-Authenticate header specifying the authentication scheme. This is common in corporate networks with authenticating proxies.
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/407
Example request:
curl -i "https://httpstatus.com/api/status/407"The client must first authenticate itself with the proxy. Response must include Proxy-Authenticate header.
On this code, Inspector focuses on semantics, headers, and correctness warnings that commonly affect clients and caches.
HTTP 407 Proxy Authentication Required 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 407 Proxy Authentication Required in Express
app.use((err, req, res, next) => {
if (err.status === 407) {
return res.status(407).json({
type: 'https://api.example.com/errors/proxy-authentication-required',
title: 'Proxy Authentication Required',
status: 407,
detail: err.message
});
}
next(err);
});from fastapi import HTTPException
# Raise 407 Proxy Authentication Required
raise HTTPException(
status_code=407,
detail={
'type': 'proxy_authentication_required',
'message': 'Descriptive error for 407 Proxy Authentication Required'
}
)// Spring Boot 407 Proxy Authentication Required handling
@ExceptionHandler(CustomProxyAuthenticationRequiredException.class)
public ResponseEntity<ErrorResponse> handleProxyAuthenticationRequired(
CustomProxyAuthenticationRequiredException ex) {
return ResponseEntity.status(407)
.body(new ErrorResponse("Proxy Authentication Required", ex.getMessage()));
}// Return 407 Proxy Authentication Required
func errorHandler(w http.ResponseWriter, message string) {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(407)
json.NewEncoder(w).Encode(map[string]any{
"status": 407,
"error": "Proxy Authentication Required",
"message": message,
})
}