When you see this status
- Client sends request through a proxy requiring authentication
- Proxy rejects request due to missing or invalid credentials
- Proxy requires credentials for the target resource
Common causes
- Missing Proxy-Authorization header
- Invalid Proxy-Authorization credentials
- Proxy configured to require authentication
- Client ignores proxy authentication challenge
How to debug it
- Verify proxy requires authentication
- Check Proxy-Authorization header format
- Validate credentials with proxy administrator
- Inspect proxy logs for authentication failure
Return this code in your framework
Express (Node.js)
res.status(407).set('Proxy-Authenticate', 'Basic realm="proxy"').send('Proxy auth required');
FastAPI (Python)
@app.get('/')
async def root(request: Request):
return Response(status_code=407, headers={"Proxy-Authenticate": "Basic"}, content="Proxy auth required")
NestJS
@Get()
proxyAuth(@Res() res: Response) {
res.status(407).set('Proxy-Authenticate', 'Basic').send('Proxy auth required');
}
Go (net/http)
http.Error(w, "Proxy auth required", 407)
w.Header().Set("Proxy-Authenticate", "Basic")
About HTTP 407
HTTP status code 407 Proxy Authentication Required is part of the
4xx Client Error family. Client must authenticate with a proxy before accessing the requested resource. Understanding it is essential for
backend engineers, API designers, and anyone debugging integrations between services.
The Qaynaq Labs HTTP Status Code Explainer covers all standard codes with practical guidance:
what triggers them, how to debug them in production, and exactly how to return them from common
frameworks. Each code page is hand-curated and verified.