What Is a 407 Status Code?
Similar to 401 Unauthorized, but it indicates that the client needs to authenticate itself in order to use a proxy.
The proxy MUST send a Proxy-Authenticate header field1 containing a challenge applicable to that proxy for the target resource. The client MAY repeat the request with a new or replaced Proxy-Authorization header field2.
- 1 Proxy-Authenticate RFC7235 Section 4.3
- 2 Proxy-Authorization RFC7235 Section 4.4
- Source: RFC7235 Section 3.2
407 CODE REFERENCES
Rails HTTP Status Symbol
Go HTTP Status Constant
Symfony HTTP Status Constant
Python2 HTTP Status Constant
Python3+ HTTP Status Constant
Python3.5+ HTTP Status Constant
Apache HttpComponents Core
407 status code example
Here is an example of a request and response for a 407 status code:
GET /private/index.html HTTP/1.1
HTTP/1.1 407 Proxy Authentication Required
Date: Tue, 15 Mar 2023 14:30:00 GMT
Proxy-Authenticate: Basic realm="Proxy Server"
In this example, the client is attempting to access a private resource on the server at www.example.com, but the server requires authentication via a proxy server. The server responds with a 407 Proxy Authentication Required status code and includes a Proxy-Authenticate header, indicating that the client needs to provide credentials for the proxy server in order to access the resource. The client can then provide the appropriate credentials and retry the request with the Authorization header set.
What causes a 407 status code?
There are several reasons why a 407 status code may occur:
- Invalid or missing credentials: The client may have provided invalid or missing credentials when attempting to authenticate with the proxy server.
- Network configuration: Issues with the client’s network configuration, such as incorrect proxy settings, can cause a 407 status code.
- Proxy server configuration: The proxy server may be configured incorrectly or may be experiencing issues that prevent it from authenticating the client.
- Access restrictions: The client may not have the necessary permissions to access the requested resource, or the proxy server may be configured to deny access to certain resources.
In summary, a 407 status code is caused by a failure to authenticate with a proxy server, typically due to issues with credentials, network or proxy server configuration, or access restrictions.
How to fix a 407 status code
A 407 status code indicates that the server requires authentication via a proxy server, and the client needs to provide valid credentials to access the resource.
Here are the steps to fix a 407 status code:
- Check the proxy configuration: Ensure that the proxy server configuration is correct, including the proxy server hostname, port, and authentication settings.
- Provide valid credentials: Check that the client is providing valid credentials for the proxy server. Credentials may be entered as part of the request headers or may be stored in the client’s configuration settings.
- Retry the request: Once valid credentials have been provided, retry the request. The client should include the Authorization header in the request, containing the appropriate credentials.
- Debug the issue: If the 407 status code persists, debug the issue by examining the server and proxy logs, checking the network configuration, and troubleshooting any issues with the client or server software.
- Contact the administrator: If the issue cannot be resolved, contact the system administrator or the support team for the software or service being used.
In summary, to fix a 407 status code, ensure that the proxy server configuration is correct, provide valid credentials, retry the request, and troubleshoot any issues as necessary.
- Learn about web development
- Learn about SEO
- Web development services from WebFX
- SEO services from WebFX
- MDN Web Docs