Skip to content

Network policy per provider

Last updated: 2026-11-22T07:30:00-03:00 (UTC-3)

Use providers[].network when one connection needs a different CA, client certificate or proxy from the global upstream network. Each connection keeps its own TLS/proxy capture and connection pools. Other providers, PostgreSQL, caches and identity providers keep their existing configuration.

features.provider_network defaults to false. A provider with an explicit profile refuses calls while the flag is off; it never falls back to a less restrictive transport. Providers without a profile continue using the global network.

Declaration Result
No network field, or YAML network: null Inherit the global CA, mTLS and proxy
network: {} Explicit replacement: system CAs, no client certificate, direct connection
Nonempty network object Replace the complete trust/proxy profile; omitted selectors use the reset defaults below

A provider profile does not merge individual credential fields with the global network. If you specify only a private CA, you do not accidentally inherit a global client identity or proxy. To use a global reference in the replacement profile, select it explicitly.

Global operation/stream deadlines, transport timeouts, IPv4 selection, HTTP version, numeric connection pools and admission limits still apply. A single proxy_url_env adds no retry loop or failover; for several proxies with health and failover, require a proxy pool.

Provision the proxy and mount the certificate files before starting the gateway. The referenced variables contain a proxy URL or a mounted file path; these values never belong in the provider API or console form.

features:
provider_network: true
providers:
- id: private-models
protocol: openai
base_url: https://llm.corporate.example/v1
api_key_env: PRIVATE_LLM_KEY
network:
ca_file_env: PRIVATE_LLM_CA_FILE
client_cert_file_env: PRIVATE_LLM_CERT_FILE
client_key_file_env: PRIVATE_LLM_KEY_FILE
proxy_url_env: PRIVATE_LLM_PROXY_URL
no_proxy:
- llm.corporate.example:443
- id: public-models
protocol: openai
base_url: https://api.openai.com/v1
api_key_env: OPENAI_API_KEY
# No profile: use the global upstream network.

In this example, the exact no_proxy match makes the private endpoint connect directly, while still requiring its configured CA and client certificate. Remove that entry to use the configured proxy. Choose the route deliberately; a bypass list is an operator policy, not a permission supplied by a caller.

Docker, Kubernetes, native binaries and NPX use the same YAML. The operator supplies the mounted files, process environment and services through that deployment’s normal mechanisms. Kubernetes Secret volume symlinks retain the existing validated-file profile; no Kubernetes distribution or addon is required by the data path.

Field Replacement default Contract
providers[].network.ca_file_env Absent: system roots ENV name containing a mounted PEM CA file path; private CA is added to system trust
providers[].network.client_cert_file_env Absent: no mTLS ENV name containing the mounted client certificate path; requires the key selector
providers[].network.client_key_file_env Absent: no mTLS ENV name containing the mounted private-key path; requires the certificate selector
providers[].network.proxy_url_env Absent: direct ENV name containing an HTTP(S) proxy URL, optionally with proxy authentication; no query, fragment or non-root path
providers[].network.no_proxy [] Up to 64 unique canonical destination patterns, each at most 256 UTF-8 bytes
providers[].network.proxy_pool Absent: no pool ID of a proxy pool declared in the YAML; every call must go through one of its members. Cannot be combined with proxy_url_env or no_proxy

Reference names follow the existing ENV-name grammar, up to 128 ASCII bytes. Empty reference strings and omission both mean absent. The object accepts no other fields. Null member values, wrong types, duplicate/case-aliased names and malformed bypass patterns are rejected. Null at the whole-profile level is the distinct inheritance choice.

TLS keeps chain and hostname verification and the existing minimum TLS version. No insecure_skip_verify option is added. Each certificate/key file uses the existing regular-file, bounded 1 MiB reader. Invalid/missing material is rejected without printing paths or contents. On Windows the reader also requires the file and the directories above it to be protected from untrusted accounts, and refuses links (mounted files on Windows). Existing platform certification for mounted files still applies; a supported binary does not by itself certify a new filesystem/OS profile.

The profile governs TLS connections made through its transport, including an HTTPS proxy hop. Choose a trusted proxy and certificate chain for that path. A no_proxy match changes only proxy selection; it never disables CA validation, mTLS or provider authentication.

Pattern Meaning
api.example.com This exact DNS name, case-insensitive
.example.com Subdomains such as a.example.com; excludes example.com and badexample.com
api.example.com:443 Exact host and effective port 443
192.0.2.10 This literal IP
192.0.2.0/24 Literal destination IPs in this canonical prefix
2001:db8::1 This literal IPv6 address
[2001:db8::1]:443 This IPv6 address and port 443

Default effective ports are 80 for HTTP and 443 for HTTPS. CIDR matching does not resolve a DNS name to guess whether its eventual address is private. Mapped literal destinations use their IPv4 equivalent consistently.

Use ASCII DNS names, including an encoded name when needed. Patterns cannot contain URLs, credentials, paths, queries, whitespace, zones, regex, *, arbitrary wildcards, malformed ports or CIDR-plus-port combinations. Prefixes must be canonical; mapped prefixes are refused. There is no automatic localhost/loopback bypass and no ambient HTTP_PROXY, HTTPS_PROXY or NO_PROXY lookup. This preserves the existing explicit-proxy contract.

Open Providers → Edit → Network policy. Choose global inheritance or an explicit replacement, select admitted reference names and edit the bounded bypass list. No PEM, key, mounted path, resolved proxy URL or proxy password is loaded into the editor.

A remote writer may select a nonempty reference only if that exact slot was admitted at process boot for the same provider ID, or is the corresponding global slot. A CA reference does not grant access to an arbitrary key slot, and one provider cannot borrow another provider’s client identity. A new console-only provider can use global admitted slots or no host material. To add new material, update the deployment/YAML and roll out first; saving a new ENV name remotely does not grant host-file access.

V21 configuration readers with current provider-write authority receive network (selected profile or null), network_references (admitted names) and the applicable provider_network_access capability. Its writer-only global_references supports creating a connection. Read-only readers receive safe network_policy configured/source/inheritance facts, with no reference inventory. These facts describe configuration, not a successful TLS handshake, negotiated protocol or health check. Team/public projections expose no profile/reference inventory.

Use the existing versioned provider PUT/DELETE API. In a complete PUT:

  • Omitting network preserves the existing profile, including for an older client.
  • "network": null restores global inheritance.
  • "network": {} selects the explicit reset.
  • A nonempty object supplies the complete replacement.

Deleting a console override restores its YAML provider/profile when one exists. Global version checks, current live role/permission, feature-license checks and audit apply to additions, removal and restoration. A flag enables behavior; it never grants access. The operational flag may be off while an authorized writer stages a valid profile, but that provider will refuse calls until activation.

A client certificate or authenticated proxy can select a different upstream account even when its reference name stays the same. Exact-cache identity and cached helper/vector-index identity therefore include private captured material identity. Existing unprofiled keys and single-target exact-cache restrictions stay unchanged. A disabled/unavailable explicit profile cannot serve a warmed exact answer.

Semantic answer caching is bypassed when the answer or embedding provider has an explicit network profile. No private material or fingerprint is exposed in metadata, logs or metrics. Updating a reference/capture does not claim semantic equivalence between upstream accounts.

The gateway validates and captures mounted material before accepting a configuration generation. It does not reread files or ENV values for each request, and it adds no file watcher. Explicit reviewed reload/configuration changes capture new material. Replacing a Secret file alone does not promise immediate transport rotation.

The accepted operation captures its configuration and transport bundle consistently. A newly admitted request uses the new generation; already admitted HTTP operations, streams and WebSockets retain their selected generation through close. Retired idle connections are closed, and late completions release their remaining ownership. There is no permanent cache of old profile fingerprints.

A failed material capture rejects the candidate before its database/control publication. Refresh failure keeps the last accepted configuration and transport; startup failure stops initialization. Missing/disabled profile transport is a known-not-sent refusal, preserving existing financial reservations and attempt semantics. It produces no upstream-attempt record or provider valuation. A pinned video observation refused before polling retains its existing job state; it does not create an unknown provider result or reroute to another account. A valid CA that does not trust a server can still produce an ordinary TLS transport failure during connection; configuration capture is not remote endpoint certification. Existing authorized fallback may choose another target under its own policy, but it never silently changes this provider to the global or direct transport.

With an explicit profile, provider-authenticated catalog calls, shared inference/resource calls, video polling and realtime establishment use that selected transport. Without a profile, authenticated catalogs retain their existing dedicated catalog client; global inference TLS/proxy settings did not previously govern that client, and this feature does not silently add them. Community/public catalogs and unrelated IdP, MCP, guardrail and log-destination clients do not acquire its client certificate. Existing redirect refusal remains in force.

When the selected provider transport actually uses a proxy with user information, including an owned captured global proxy, the gateway withholds error bodies and untrusted response headers instead of searching them for a password. At the provider-transport boundary, the response retains its HTTP status and a fixed native-format error with provider_proxy_error_withheld. Public routes retain their existing mappings: for example, a catalog failure can become 503 and an asynchronous video failure can become 502. A rejected WebSocket upgrade is also withheld, including an upstream 200 that did not complete the upgrade. This applies regardless of credential length or what the error text contains. Proxy-visible transport errors use a finite message while retaining cancellation/timeout classification internally.

HTTP status-based retries/fallback retain their existing rules. Context-window/content-policy fallback cannot classify text that was withheld; no hidden text channel bypasses the privacy boundary. Direct connections, matching no_proxy routes and proxies without authentication retain their ordinary error treatment. Successful responses are unchanged. Global inheritance keeps its existing transport/trust selection; authenticated global proxy errors receive the same privacy repair. Unauthenticated and direct global requests are unchanged. Dedicated catalog clients that do not use that proxy do not acquire this treatment.

A proxy pool is a named set of outbound HTTP(S) proxies. A provider profile that sets proxy_pool requires the pool: every call goes through one of its members, and when no member can take it the call is refused before reaching the provider. It is never sent directly, through the global proxy or through another pool. It needs features.proxy_pools (operator control, off by default, requires provider_network).

features:
provider_network: true
proxy_pools: true
proxy_pools:
- id: egress-eu
strategy: failover # or round_robin
max_in_flight: 256
max_connections_per_member: 64 # omit to inherit network.max_connections_per_host
failure_threshold: 3
cooldown_seconds: 30
providers: [other-models] # optional: more providers a remote writer may attach
members:
- id: eu-1
proxy_url_env: EGRESS_EU_1 # http(s)://[user:password@]host:port
- id: eu-2
proxy_url_env: EGRESS_EU_2
providers:
- id: private-models
protocol: openai
base_url: https://llm.corporate.example/v1
api_key_env: PRIVATE_LLM_KEY
network:
ca_file_env: PRIVATE_LLM_CA_FILE
proxy_pool: egress-eu
Field Default Bounds and meaning
id required Unique, ^[a-z][a-z0-9_-]{1,63}$; at most 32 pools
members[] required 1–16 members, each a unique id (same pattern as the pool ID) and a distinct proxy_url_env (the ENV name holding an http or https proxy URL, optionally with user information; no path, query or fragment)
strategy failover failover tries members in order, the first healthy one first; round_robin rotates the first member over the healthy ones
max_in_flight 256 1–10,000 requests through the pool at once, on this replica, across every provider and HTTP version that uses it. One more is refused at once with 503 provider_proxy_pool_saturated, not queued. A streaming response holds its slot until it ends
max_connections_per_member inherits network.max_connections_per_host 1–1,024 connections per destination through one member; further requests wait for a connection within the request’s own deadline. Each member also keeps its own idle connections, so idle connections can reach members × network.max_idle_connections
failure_threshold 3 1–100 consecutive member faults that eject a member
cooldown_seconds 30 1–3,600 seconds an ejected member is skipped; afterwards real traffic tries it again, and one more fault ejects it again. Concurrent calls in that moment all try it and fail over if it is still down
providers [] Up to 64 provider IDs that may require this pool besides providers whose YAML profile already requires it (see authority below)

A profile with proxy_pool cannot also set proxy_url_env or no_proxy: a required pool has no direct bypass. CA and client-certificate selectors combine with it as usual, and TLS to the provider is verified end to end through the member’s tunnel.

Failover is safe by construction. The gateway moves a request to the next member only when the previous one never produced a connection: the proxy refused the TCP connection, the CONNECT was answered with an error, the member did not finish connecting within the connect timeout (network.connect_timeout plus the TLS handshake timeout; a proxy that accepts and never answers would otherwise hold the request until its deadline), or the tunnel’s TLS handshake failed. Nothing of the request was written, so a body is replayed on the next member. Once a connection exists the request is never replayed, whatever happens next: the answer, or the error, is the call’s outcome, and the usual retry and fallback rules apply to it. A body that cannot be replayed is never sent through a second member.

Health is passive and counts member faults only. Only real requests feed it, and nothing probes a member, so no request is sent just to test a proxy. A fault is a failed connection to the member, no CONNECT answer within the connect timeout, or 407 Proxy Authentication Required. A CONNECT refused for the destination (403, 502, 503…) or a TLS failure toward the provider after a successful CONNECT still fails the request over, but is not counted: it belongs to that provider, and must not eject a member other providers rely on. A success resets a member’s fault count. Health is per replica and lives in memory: a restart or a configuration change to a member’s URL starts it healthy.

Refusals. When every member is ejected or fails to connect, the call ends with 503 provider_proxy_pool_unavailable before any provider call. It is a known-not-sent refusal, handled exactly like the profile’s other ones described in reload, rotation and failure: no provider valuation and the same financial-reservation and attempt semantics. Fallback to another target of the model follows its own policy and its own network profile. With proxy_pools off, a provider that requires a pool refuses the same way, and its models report not ready. A realtime WebSocket handshake refused this way answers 502 upstream_unavailable, as other realtime handshake failures do; nothing reached the provider.

Material and authority. Pools are boot trust, like reference names: their members are captured from the environment when the configuration is accepted, and a missing or malformed member URL rejects the configuration, even while proxy_pools is off. A pool’s members carry credentials and network reach, so a pool is admitted per provider, like a reference slot: a remote writer can make a provider require a pool (Providers → Edit → Network policy → Required proxy pool, or "proxy_pool" in the provider PUT body) only when that provider’s YAML profile already requires it or the pool lists the provider under providers. Any other choice is refused (422). Adding a pool, a member or a listed provider requires a YAML change and rollout. Provider readers with write access receive the admitted pools of each provider as network_proxy_pools; provider_network_access.proxy_pools lists every declared pool for creating a provider, and the server still applies the admission rule to the new ID. A member with user information receives the authenticated proxy error privacy treatment: when any member of the pool is authenticated, every error answer through the pool is withheld. The pool’s member URLs join the private capture identity used for cache isolation.

Status. GET /api/v1/admin/proxy-pools (providers:read, proxy_pools on) lists each pool (proxy_pools, with the YAML names: strategy, max_in_flight, max_connections_per_member, failure_threshold, cooldown_seconds, as effective values) with the providers that require it and, per member, its ID, scheme, whether it is authenticated, whether it is ejected, consecutive failures, successes and connection failures. It never returns proxy URLs, hosts, credentials or reference names. The console shows the same under Providers → Proxy pools.

No new schema migration or secret-ciphertext family is needed: stored provider JSON contains reference names and bypass tokens, never resolved material. Mount admitted files/variables consistently on every replica.

Upgrade or quiesce all older readers/writers before persisting profiles; older binaries can ignore the new JSON field or replace it on a full write. A mixed-version pool cannot enforce this policy reliably. Back up the existing configuration/database and keep recovery on the new binary. Repair the material/reference and explicitly reload; do not recover by bypassing TLS validation or routing through an old replica.

m7gtw[email protected]