Repository navigation
Description
Describe the feature you'd like and the problem it will solve
probes/http (ProbeConf.proxy_url / proxy_connect_header, fields 16/23 in probes/http/proto/config.proto) lets an HTTP probe route its request through an explicit, per-probe HTTP/HTTPS proxy. The Starlark probe (probes/starlark/proto/config.proto) has no equivalent: there is no proxy_url-style config field, and the http builtin's get/post/put/ patch/delete functions have no proxy= kwarg.
Today, the only way a Starlark script's HTTP calls end up going through a proxy at all is if the cloudprober process happens to have HTTP_PROXY/HTTPS_PROXY set in its OS environment (picked up implicitly via http.DefaultTransport's ProxyFromEnvironment, since newHTTPClient in probes/starlark/runtime.go never overrides Transport.Proxy). That's not a real substitute for explicit configuration:
- Not configurable per probe, only per process - every Starlark probe hosted by the same cloudprober instance shares the same proxy behavior, with no way to give one probe a proxy and another direct access.
- Not configurable per call/per host within a single script execution - unlike TLS, where
tls_configs(a named map, selected in-script viatls="name"on eachhttp.*call) already lets one script apply different TLS behavior to different hosts in the same run. There's no proxy analogue of that pattern, even though a single Starlark probe execution routinely makes calls to several different hosts that may need different proxy treatment (or none at all). - Entirely implicit - nothing in the probe's own config declares or documents that a proxy is in use, unlike
http_probe.proxy_urlbeing an explicit, visible part of the probe definition.
This makes Starlark probes impractical as an HTTP-based probe type in any environment where egress is only permitted through an explicit proxy (a common setup in locked-down enterprise networks), even though the HTTP probe type already supports exactly this scenario.
I'd like to add a named proxy_configs map to starlark.ProbeConf, mirroring the existing tls_configs map / tls= kwarg design, plus a proxy= kwarg on the http builtin's call functions, so a script can select a named proxy per call:
starlark_probe {
source_file: "probe.star"
proxy_configs {
key: "corp"
value { proxy_url: "http://proxy.internal:3128" }
}
}def probe(target):
r = http.get(url = "https://example.com/healthz", proxy = "corp")
assert.http_status(r, 200)A named map (rather than a single probe-wide proxy_url, as the HTTP probe type uses) is deliberate: one Starlark probe execution can issue calls to multiple distinct hosts, unlike the HTTP probe type where one execution is always exactly one request to one target - so a single proxy field wouldn't cover the same range of use cases tls_configs already does for TLS.
I have a working prototype of this (proto field, runtime client-selection plumbing, proxy= kwarg, and tests covering named-config selection, direct connection when omitted, mutual exclusion with an unrelated TLS name, unknown proxy name, and no proxy_configs configured at all) and I'm happy to open a PR against this issue. Cloudprober version tested against: v0.14.5 (also present on main, commit 58ba587e).
Activity
manugarg commentedon Sep 29, 2026
Thanks for the detailed write-up, @aholden85. I agree this is a real gap. Relying on the process's HTTPS_PROXY is implicit, and it's the same for every probe in the process.
I'd like to go a bit simpler than a named proxy_configs map, though.
Why not mirror tls_configs? Per-call TLS selection exists because TLS settings are genuinely per host: ca_cert_file replaces the system CA pool, server_name is an override for one host, and so on. Proxies don't really work that way. In locked-down networks there's almost always one egress proxy, and the per-host question is "proxy or direct" (internal hosts usually need to skip it), not "which proxy".
There's also an implementation cost. The proxy and the TLS config both live on the http.Transport, which owns the connection pool. With independent tls= and proxy= selectors, we'd need a client for every (tls, proxy) combination to keep them composable, and composability matters: an internal host with a private CA behind the corporate proxy is exactly the case we want to cover.
Proposal: one probe-level proxy, with a no_proxy exclusion list.
If a real need for several different proxies in one probe comes up later, we can add a named map then. I'd rather not design for it up front.
aholden85 commentedon Oct 14, 2026
Hi @manugarg - just checking if you've had a chance to review the PR yet? I'm running into more situations where we could really use this kind of configuration in our environment.
manugarg commentedon Oct 14, 2026
@aholden85 Apologies for the delay. I'll review it in a couple of days.
[probes.starlark] add probe-level proxy support (cloudprober#1513)