Skip to content
HTTP errors in web scraping and automation · error message

HTTP: 407 Proxy Authentication Required

ConfigurationHTTP 407Access and blocking (401, 403, 407, 451)

Last verified

The exact message
ProxyError('Unable to connect to proxy', OSError('Tunnel connection failed: 407 Proxy Authentication Required'))

What it means

407 comes from a proxy between you and the website, not from the website. It works like 401, but for the proxy: the proxy requires credentials and sends a Proxy-Authenticate header describing the scheme. Until the proxy accepts your credentials, your request never reaches the target site.

It most often appears on corporate networks that route traffic through an authenticating proxy, in CI or container environments that inherit HTTP_PROXY/HTTPS_PROXY variables, and with commercial proxy services when the username or password in the proxy URL is wrong. In Python requests, an HTTPS request through a proxy surfaces it as a ProxyError wrapping "Tunnel connection failed: 407".

What is not wrong: the target website has not blocked you. Fixing your code's handling of the target will not help.

What it looks like

proxies = {"https": "http://user:p%[email protected]:8080"}
requests.get("https://example.com", proxies=proxies, timeout=30)

Why it happens

  • Proxy credentials are missing, wrong or expired.
  • Special characters in the username or password are not URL-encoded in the proxy URL.
  • The environment sets HTTPS_PROXY globally, so the script uses a proxy you did not intend.
  • The proxy uses NTLM or Kerberos, which the HTTP client does not support natively.

How to fix it

  1. Print the effective proxy settings (environment variables and code) to confirm which proxy is used.
  2. Put credentials in the proxy URL as http://user:password@host:port, URL-encoding special characters.
  3. Verify the credentials with curl -x http://user:pass@host:port https://example.com -I.
  4. If you did not intend to use a proxy, unset the variables or add the host to NO_PROXY.
  5. On corporate networks, ask IT for the approved proxy configuration and authentication method.

How to stop it recurring

Keep proxy configuration explicit in one place, store credentials as secrets, and test connectivity at startup. Document NO_PROXY for internal hosts so local services do not route through the proxy.

Official documentation: developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/407. See all HTTP error messages.

Related errors

Definitions

Quick answers

What does "407 Proxy Authentication Required" mean in HTTP?

407 comes from a proxy between you and the website, not from the website. It works like 401, but for the proxy: the proxy requires credentials and sends a Proxy-Authenticate header describing the scheme. Until the proxy accepts your credentials, your request never reaches the target site.

How do I fix "407 Proxy Authentication Required"?

1. Print the effective proxy settings (environment variables and code) to confirm which proxy is used. 2. Put credentials in the proxy URL as http://user:password@host:port, URL-encoding special characters. 3. Verify the credentials with curl -x http://user:pass@host:port https://example.com -I. 4. If you did not intend to use a proxy, unset the variables or add the host to NO_PROXY. 5. On corporate networks, ask IT for the approved proxy configuration and authentication method.

Retries and timeouts without writing the loop

Autonoly's HTTP Request node and browser steps have per-node retries, timeouts and continue-on-fail, so a transient 429 or 503 can back off instead of failing the run. It has no proxies or IP rotation: if a site blocks automated traffic, that block applies to Autonoly too.

Also see Error handling in workflows.