Skip to content

Selenium Proxy Ignored in Headless: 3 Causes and a Test

Find out in a few minutes whether Chrome is really using your proxy, and fix the login problem that most often breaks it.

The 3 most common causes

Cause 1: the login is written into the proxy address. Chrome documents that it does not use credentials embedded in the proxy settings, so --proxy-server=http://LOGIN:PASSWORD@HOST:PORT does not log in. In a normal window you may see a sign-in box and type the login by hand; in headless there is no window to type into, so the page just fails.

Cause 2: the headed and headless runs do not use the same proxy source. The Chromium network stack uses the system network settings by default, and a desktop profile may also carry a proxy extension. A container or CI runner has neither, so the same script exits with the machine's own IP, or fails to connect.

Cause 3: protocol or port does not match. HTTP and SOCKS5 use different ports on the Proxy302 gateway (2222 and 3333), and Chrome supports no authentication for SOCKS5. If you run a login-protected SOCKS5 proxy in Chrome through Selenium, it will not work whatever the headless setting is.

A fourth thing looks like a drop: on a rotating line each new connection gets a new IP, so a long script can show a different exit IP half way through. That is how the line works, not a fault.

Ways to give Chrome a proxy, and what they do with the login

Ways to give Chrome a proxy, and what they do with the login
ItemLogin handled?Notes
--proxy-server=http://HOST:PORTNoFine for a proxy that needs no login; otherwise the request is refused
Login inside the address (http://LOGIN:PASSWORD@HOST:PORT)NoChrome does not use credentials embedded in proxy settings
Selenium Proxy object (options.proxy)NoSets the address and type; it has no login for Chrome to use
Local forwarder (for example gost) that adds the loginYesChrome connects to 127.0.0.1 without a login; the forwarder logs in to the proxy
selenium-wireYes, documentedThe repository was archived on 3 January 2024 and is no longer maintained, so avoid it in new projects

Read from the Chromium proxy notes, the Selenium driver options page and the selenium-wire repository on 13 November 2026. "Yes" means the documentation describes it; test with your own Chrome and chromedriver versions.

Check it in 4 steps

  1. Step 1: Test the login outside the browser

    Open My assets, copy HOST, PORT, USERNAME and PASSWORD, and run the curl line in the code block below. It should print the exit IP and country. If curl fails, the problem is the proxy details, not Selenium or headless.

    Expected result curl prints the exit IP of the proxy.

  2. Step 2: Use the HTTP port for the browser

    Chrome supports no login for SOCKS5, so give it an HTTP asset (port 2222 on Proxy302). A per-IP static lease also answers over HTTP on 2222 with the same login when it was bought as SOCKS5 (tested 4 November 2026); other assets keep the protocol they were created with.

  3. Step 3: Start a local forwarder and point Chrome at it

    Run the gost line below. It listens on 127.0.0.1:8080 and logs in to the proxy for you. Then start Chrome with --proxy-server=http://127.0.0.1:8080 and no login at all. Check the options of your gost version before you rely on it.

    Before continuing Bind it to 127.0.0.1, not to all addresses, otherwise other machines on your network can use your proxy login.

  4. Step 4: Print the exit IP from inside the headless browser

    Run the Python test below. A page that loads proves nothing, because Chrome may have gone out directly. Only the printed IP shows the real route: it should match the curl result from step 1.

    Expected result The printed IP equals the one from curl.

Test the login and start the forwarder

# 1) test the login outside the browser (HTTP port)
curl -x http://LOGIN:PASSWORD@HOST:2222 https://ipinfo.io/json

# 2) local forwarder: Chrome connects here without a login
gost -L http://127.0.0.1:8080 -F http://LOGIN:PASSWORD@HOST:2222

Example only: replace LOGIN, PASSWORD and HOST with the values from My assets; percent-encode special characters such as @ (%40) in the login.

Selenium test that prints the exit IP

from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By

options = Options()
options.add_argument("--headless=new")
# the local forwarder from step 3: no login in this address
options.add_argument("--proxy-server=http://127.0.0.1:8080")

driver = webdriver.Chrome(options=options)
try:
    driver.get("https://ipinfo.io/json")
    print(driver.find_element(By.TAG_NAME, "body").text)
finally:
    driver.quit()

Example only. It needs Chrome and a matching chromedriver (or Selenium Manager). If it prints your own IP, Chrome is not using the proxy.

If it still fails

Works with a window, shows your own IP in headless

Check Where did the window run get its proxy: a system proxy, an extension, or a profile?

Fix Set the proxy explicitly with --proxy-server in the headless run, and print the IP as in step 4. Do not rely on settings that exist only on your desktop.

ERR_PROXY_CONNECTION_FAILED or ERR_TUNNEL_CONNECTION_FAILED

Check Does the curl test from step 1 pass, and is the forwarder still running?

Fix Fix the host, port and protocol first (HTTP, port 2222). The proxy connection guide lists the checks in order.

407 or a sign-in page instead of the site

Check Is the login still written into the --proxy-server address?

Fix Remove it from the address and let the forwarder send it. Chrome ignores the embedded login.

The exit IP changes in the middle of a long script

Check Is it a rotating line? Each new connection gets a new IP.

Fix For a task that must keep one IP, use a static IP, or open a session on a dynamic line.

On Proxy302

The gateway has an HTTP port, 2222, and a SOCKS5 port, 3333. For Selenium with Chrome use HTTP. Rotating residential gives a new IP on every new connection, which suits many independent page loads. For a test that must keep one exit, a static ISP IP does not rotate during the lease and costs US$0.50 for 1 day or US$7.99 for 30 days.

There is no free trial; the smallest purchase is one IP for one day or 1 GB of rotating residential traffic.

FAQ

Does headless Chrome ignore the proxy?

Not by design. Chrome now has one unified headless mode, and --proxy-server applies to it as in a normal window. What differs is where the proxy comes from and who can answer a sign-in prompt, which is why the same script behaves differently.

Should I write --headless or --headless=new?

The Selenium docs list --headless=new among the common Chrome arguments, and Chrome's documentation says the --headless flag runs the unified mode. Either works with a current Chrome; the old mode now exists only as chrome-headless-shell.

Can I put the username and password in the proxy address in Selenium?

Not with Chrome: it will not use credentials embedded in proxy settings. Use a local forwarder that adds the login, as in step 3.

How do I know the browser really uses the proxy?

Open an IP page inside the same headless session and compare the printed IP with the curl result. A page that loads is not proof.

Is selenium-wire still a good choice?

Its repository was archived on 3 January 2024 and the page says it is no longer maintained. It may still run on old setups, but for a new project a local forwarder is simpler to keep working.

Reference links

8
  1. Chromium docs: Proxy support in Chrome

    Official documentation · Confirmed on:

    Read on 13 November 2026: Chrome "does not implement this, and will not use any credentials embedded in the proxy settings"; proxy authentication "will instead go through the ordinary flow to find credentials"; "No authentication methods are supported for SOCKSv5 in Chrome"; with an HTTP proxy name resolution is deferred to the proxy.

  2. Chromium docs: Network settings

    Official documentation · Confirmed on:

    Read on 13 November 2026: "The Chromium network stack uses the system network settings", proxy settings among them; --proxy-server takes a single URI or a scheme mapping, and --proxy-bypass-list only has an effect together with --proxy-server.

  3. Chrome for Developers: Chrome Headless mode

    Official documentation · Confirmed on:

    Read on 13 November 2026: Chrome has unified Headless and headful modes and the --headless flag runs the unified mode; since Chrome 132.0.6793.0 the old Headless mode is only available as the standalone chrome-headless-shell binary.

  4. Selenium docs: Chrome browser options

    Official documentation · Confirmed on:

    Read on 13 November 2026: commonly used Chrome args include --start-maximized, --headless=new and --user-data-dir; the Chrome and chromedriver major versions must match.

  5. Selenium docs: Driver options (proxy)

    Official documentation · Confirmed on:

    Read on 13 November 2026: the Python example sets options.proxy = Proxy({'proxyType': ProxyType.MANUAL, 'httpProxy': 'http.proxy:1234'}), with the Proxy and ProxyType classes imported from selenium.webdriver.common.proxy.

  6. selenium-wire repository

    Official documentation · Confirmed on:

    Read on 13 November 2026: "This repository was archived by the owner on Jan 3, 2024" and "Selenium Wire is no longer being maintained"; its README documents a username and password in the proxy URL for HTTP Basic Auth.

  7. GOST documentation: forwarding chain

    Official documentation · Confirmed on:

    Read on 13 November 2026: the page shows "gost -L http://:8080 -F https://192.168.1.1:8080" style commands, where -L is a local service and every -F adds a hop of the forwarding chain. Credentials in the -F address follow the same URL form; check your gost version.

  8. Proxy302 product facts and price list

    Product observation · Confirmed on:

    Product facts file of the site (prices in US$, 1 PTC = US$1, protocols and ports, lease terms; protocol tests of 4 November 2026 and the rotating datacenter line of 10 November 2026). Checked on 13 November 2026.

Ready to try it?

Create an account, top up once, then pick rotating residential, static ISP or datacenter IPs and have one running in your browser within minutes.