Skip to Content

Web proxy chaining

How a Bytesafe proxy sits behind your company's web proxy, why the web proxy trusts a Bytesafe certificate, and how requests are routed to firewalls and attributed.

A company web proxy, such as Zscaler, Prisma Access, or Squid, already sits between developers and the internet and already decrypts their TLS traffic. A Bytesafe proxy is a destination that web proxy can hand registry traffic to. The web proxy decides which hosts go there; Bytesafe decides which firewall checks each request.

Package managers can keep their registry settings. Requests that reach the company proxy and match its forwarding rules go through the attached firewall. For setup, see Connect a web proxy.

Two TLS connections

A request crosses two encrypted connections. The package manager talks TLS to the web proxy, which presents a certificate from the company's own CA, already trusted on developer machines. The web proxy then talks TLS to Bytesafe, asking for the same registry host.

Developer
Web proxy
Bytesafe
Registry
Every install
npm install, to registry.npmjs.org
decrypt, match a forwarded host
Request plus the proxy credential
route to the firewall, check rules
Fetch the package
Package, or a block
Same answer, re-encrypted
Developer
Web proxy
Bytesafe
Registry
request response

On that second connection the web proxy expects a certificate for registry.npmjs.org, not for a Bytesafe hostname. Bytesafe cannot present the registry's real certificate, so it presents one signed by a CA the web proxy trusts. That is the only reason a proxy has a CA: it proves the Bytesafe end of the chain to your web proxy. Developer machines never see it.

Routing to firewalls

Each proxy has firewalls attached. Every host those firewalls cover is routed to the firewall that covers it:

  • the ecosystem's public registry, such as registry.npmjs.org or pypi.org
  • hosts the ecosystem's stock package managers use besides it: registry.yarnpkg.com for npm, index.rubygems.org for RubyGems
  • the host of each upstream, including inherited ones, so a firewall in front of an internal registry routes that host too

If two attached firewalls cover the same host, Bytesafe routes it to neither. Attaching both is refused. If a later upstream change creates the overlap, the host stays unrouted until you remove it. Requests for hosts the proxy does not route are refused.

A routed request goes through the firewall's normal routes. Package metadata the firewall returns points downloads at the Bytesafe API host, which is why the web proxy forwards that host too. For npm, a lockfile whose tarball URLs point at registry.npmjs.org also works: those paths are translated to the firewall's download route.

Which CA answers

A web proxy either opens a tunnel with CONNECT and then talks TLS inside it, or talks TLS to Bytesafe directly as if Bytesafe were the registry. Either way, Bytesafe answers the TLS handshake before any request arrives, so it can only use what it knows at that moment.

Web proxy opens TLS
Credential sent with the tunnel?
That proxy's certificate choiceeach request must carry that proxy's credential
Default proxy for this endpoint?
Shared root in this deployment?
Shared Bytesafe rooteach request must carry a shared-root proxy's credential
Handshake refused
  • This proxy's own CA isolates the proxy: its key signs certificates for nothing else. The web proxy has to send the credential as Proxy-Authorization when it opens the tunnel, so Bytesafe knows the proxy in time.
  • Shared Bytesafe root is one root for every proxy in the deployment. Bytesafe can answer any handshake with it, so the credential can arrive later, in the X-Bytesafe-Proxy-Token header on each request. A web proxy that already trusts the root needs nothing new for a second proxy.

A self-hosted endpoint can also name one default proxy, which answers every handshake that arrives without a credential. That covers a single web proxy without a shared root.

The shared root signs through an issuing CA below it, so the issuing key can be replaced without anyone installing a new root.

Choosing the certificate

The choice follows from how your web proxy can send the credential:

Your web proxyCertificate
Opens a tunnel and can send Proxy-AuthorizationEither. This proxy's own CA keeps the proxy isolated
Can only add a header to each requestShared Bytesafe root
Connects to Bytesafe over TLS without a tunnelShared Bytesafe root

The dashboard offers the choice only when the deployment has a shared root. Without one, every proxy uses its own CA.

Credential and attribution

A proxy's credential (prx-...) can fetch packages only through the proxy's attached firewalls, and a proxy with no firewalls does not authenticate at all. Rotating it replaces it at once.

Because the proxy makes the requests, log entries record the proxy instead of a user. A web proxy can report who it authenticated in a header such as X-Authenticated-User. When the proxy is set to trust that header, the value is recorded as proxyUser. It is the web proxy's claim and grants nothing: it does not affect permissions or rule evaluation. Field details: Logs reference.