HTTP status code 407 Proxy Authentication Required indicates that a client request was blocked because the proxy server requires authentication credentials before forwarding the request to the target server.
Proxy-Authenticate headerProxy-AuthorizationWhen a proxy intercepts a request, it may demand credentials. Until valid authentication is provided, all forwarded requests will fail with status code 407.
// Example of a raw HTTP response from a proxy
HTTP/1.1 407 Proxy Authentication Required
Proxy-Authenticate: Basic realm="Corporate Proxy"
Content-Length: 0
// cURL request with proxy authentication
curl -x http://proxy.example.com:8080 -U username:password https://example.com
If credentials are missing or invalid, the proxy blocks the request and returns 407. Once valid credentials are supplied, the proxy forwards the request and normal responses resume.
Simulated Corporate Proxy
Try connecting without credentials, then try with admin / 1234
// Simulated proxy check using JavaScript
function proxyRequest(authProvided) {
if (!authProvided) {
return "407 Proxy Authentication Required";
}
return "200 OK - Request Forwarded";
}
console.log(proxyRequest(false));
console.log(proxyRequest(true));