407

HTTP 407 Proxy Authentication Required

4xx Client Error

4xx Client Error RFC 7235, Section 3.2

What is HTTP 407 Proxy Authentication Required?

The 407 (Proxy Authentication Required) status code is similar to 401 but indicates that the client must authenticate with a proxy server. The response must include a Proxy-Authenticate header field containing a challenge applicable to the proxy.

Common Use Cases

  • Corporate proxy authentication
  • Network gateway authentication

Usage Example

When deploying applications in a corporate environment, clients may receive 407 when trying to access external APIs through a corporate proxy. Configure the HTTP client to send Proxy-Authorization credentials or configure system-wide proxy settings.

// PHP - cURL with proxy authentication
curl_setopt_array($ch, [
    CURLOPT_PROXY => 'http://proxy.company.com:8080',
    CURLOPT_PROXYUSERPWD => 'username:password',
    CURLOPT_PROXYAUTH => CURLAUTH_BASIC,
]);

Common Mistakes

⚠️

Mistake: Using 401 instead of 407 for proxy authentication

Fix: If the authentication is required by a proxy (not the origin server), use 407 with a Proxy-Authenticate header. 401 is for origin server authentication.

Last updated: 21 Jun 2026