Skip to main content
Back to Community & Earn Hub
Q&A Questionai-agents +150 pt Bounty

Playwright + Browser-Use Agents Behind Corporate Proxies: How to prevent TLS inspection certificate errors and CDP WebSocket drops in Docker?

@pooja_nair5 days ago 1484 views

We containerized our Playwright / Browser-Use autonomous web agents in mcr.microsoft.com/playwright/python Docker images for enterprise customers behind corporate TLS-inspecting proxies (Zscaler / Palo Alto).

What Fails

Even after copying the corporate root .crt into /usr/local/share/ca-certificates/ and running update-ca-certificates + export NODE_EXTRA_CA_CERTS=...:

  1. Headless Chromium still aborts external HTTPS navigation with net::ERR_CERT_AUTHORITY_INVALID.
  2. Worse, HTTP_PROXY / HTTPS_PROXY causes Playwright's own internal CDP WebSocket (ws://127.0.0.1:xxxxx) traffic to attempt routing through the corporate proxy, hanging page.goto() indefinitely!

Why does Chromium ignore Linux /etc/ssl/certs inside Docker, and how do we properly wire the corporate CA without disabling TLS verification globally?

1 Answers

Community Answers

@karthik_sundaram Accepted Answer5 days ago

Two distinct Linux/Chromium subsystems are tripping you up here:

  1. Chromium on Linux does NOT read /etc/ssl/certs or NODE_EXTRA_CA_CERTS—it reads its own NSS Shared DB at ~/.pki/nssdb!
  2. Playwright's Python/Node driver uses 127.0.0.1 / localhost for CDP, so NO_PROXY must explicitly exclude loopback addresses.

Here is the clean, secure production Dockerfile fix (never use ignore_https_errors=True in prod!):


1. Import the Corporate Root CA into Chromium's NSS DB (certutil)

Install libnss3-tools in your Dockerfile and register the proxy CA into /root/.pki/nssdb (or your non-root user's $HOME/.pki/nssdb):

dockerfile
FROM mcr.microsoft.com/playwright/python:v1.49.0-noble

RUN apt-get update && apt-get install -y libnss3-tools ca-certificates && rm -rf /var/lib/apt/lists/*

# 1. Copy corporate proxy CA cert
COPY corp-proxy-ca.crt /usr/local/share/ca-certificates/corp-proxy-ca.crt
RUN update-ca-certificates

# 2. Register CA directly into Chromium's NSS database
RUN mkdir -p /root/.pki/nssdb &&     certutil -N -d sql:/root/.pki/nssdb --empty-password &&     certutil -A -d sql:/root/.pki/nssdb -n "CorpProxyCA" -t "C,," -i /usr/local/share/ca-certificates/corp-proxy-ca.crt

# 3. Also set SSL_CERT_FILE for Python httpx/requests & Node
ENV SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt     REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt     NODE_EXTRA_CA_CERTS=/usr/local/share/ca-certificates/corp-proxy-ca.crt

2. Exclude Loopback from Proxy (NO_PROXY) for CDP WebSockets

Always set NO_PROXY in your container environment AND pass bypass cleanly in Playwright launch args so CDP 127.0.0.1 sockets never hit Zscaler:

dockerfile
ENV NO_PROXY="localhost,127.0.0.1,::1,.internal"     no_proxy="localhost,127.0.0.1,::1,.internal"

With certutil + NO_PROXY, headless Chromium trusts your corporate TLS gateway natively and local CDP WebSockets connect in <5ms with zero proxy hangs.

Have a solution or working configuration?

Sign in or create a free account to answer this question (+10 pts, +25 pts if accepted) and tag helpful AIStoreHub repositories.