@@ -232,8 +232,9 @@ type BrowserNetworkConfig struct {
232232 // or reserved IP ranges are rejected, as are entries that overlap private_hosts.
233233 // Enforced at Kernel's egress proxy only: destinations in private_hosts, and
234234 // processes in the browser VM that do not use the browser's proxy, are not
235- // filtered, and Kernel's own control traffic is always allowed. Requires proxy v3.
236- // Not supported on browser pools.
235+ // filtered, and Kernel's own control traffic is always allowed. Can be replaced or
236+ // removed while the session runs with PATCH /browsers/{id_or_name}. Requires proxy
237+ // v3. Not supported on browser pools.
237238 AllowedHosts []string `json:"allowed_hosts"`
238239 // Destinations the browser reaches directly through the session's own network
239240 // instead of through Kernel-managed egress — for private hosts reachable over a
@@ -359,8 +360,9 @@ type BrowserNetworkConfigParam struct {
359360 // or reserved IP ranges are rejected, as are entries that overlap private_hosts.
360361 // Enforced at Kernel's egress proxy only: destinations in private_hosts, and
361362 // processes in the browser VM that do not use the browser's proxy, are not
362- // filtered, and Kernel's own control traffic is always allowed. Requires proxy v3.
363- // Not supported on browser pools.
363+ // filtered, and Kernel's own control traffic is always allowed. Can be replaced or
364+ // removed while the session runs with PATCH /browsers/{id_or_name}. Requires proxy
365+ // v3. Not supported on browser pools.
364366 AllowedHosts []string `json:"allowed_hosts,omitzero"`
365367 // Destinations the browser reaches directly through the session's own network
366368 // instead of through Kernel-managed egress — for private hosts reachable over a
@@ -446,6 +448,32 @@ func (r *BrowserNetworkConfigProxyRouteProxyParam) UnmarshalJSON(data []byte) er
446448 return apijson .UnmarshalRoot (data , r )
447449}
448450
451+ // Network configuration changes for a running browser session. Other network
452+ // settings can only be set at creation.
453+ type BrowserNetworkUpdateParam struct {
454+ // Replaces the session's egress allowlist, using the same entry rules as
455+ // network.allowed_hosts on create. Omit to leave the allowlist unchanged, or set
456+ // to null to remove it and return to unfiltered egress; an empty list is invalid.
457+ // The new list applies without restarting the browser: new requests to
458+ // destinations it no longer allows are refused within a few seconds, and open
459+ // connections to them are closed within about 30 seconds, or up to 10 minutes
460+ // during a Kernel deploy. Connections to destinations it still allows, such as
461+ // WebSockets, stay open. A start_url in the same request must be allowed by the
462+ // updated list, and is loaded only after the list takes effect. Requires a browser
463+ // created with proxy v3, and not supported on pooled browsers. If the request
464+ // fails, retry it: the new list may already apply to some requests.
465+ AllowedHosts []string `json:"allowed_hosts,omitzero"`
466+ paramObj
467+ }
468+
469+ func (r BrowserNetworkUpdateParam ) MarshalJSON () (data []byte , err error ) {
470+ type shadow BrowserNetworkUpdateParam
471+ return param .MarshalObject (r , (* shadow )(& r ))
472+ }
473+ func (r * BrowserNetworkUpdateParam ) UnmarshalJSON (data []byte ) error {
474+ return apijson .UnmarshalRoot (data , r )
475+ }
476+
449477// Browser pool this session was acquired from, if any.
450478type BrowserPoolRef struct {
451479 // Browser pool ID
@@ -1580,7 +1608,8 @@ type BrowserNewParams struct {
15801608 //
15811609 // Any of "8GiB", "16GiB".
15821610 Memory BrowserMemoryRequest `json:"memory,omitzero"`
1583- // Network configuration for the browser session. Cannot be changed after creation.
1611+ // Network configuration for the browser session. Only allowed_hosts can be changed
1612+ // after creation, with PATCH /browsers/{id_or_name}.
15841613 Network BrowserNetworkConfigParam `json:"network,omitzero"`
15851614 // Profile selection for the browser session. Provide either id or name. If
15861615 // specified, the matching profile will be loaded into the browser session.
@@ -1791,6 +1820,8 @@ type BrowserUpdateParams struct {
17911820 // category settings for per-category updates. Explicitly disabling all four
17921821 // categories also stops capture.
17931822 Telemetry BrowserUpdateParamsTelemetry `json:"telemetry,omitzero"`
1823+ // Network configuration changes to apply to the running browser session.
1824+ Network BrowserNetworkUpdateParam `json:"network,omitzero"`
17941825 // Profile to load into the browser session. Only allowed if the session does not
17951826 // already have a profile loaded.
17961827 Profile shared.BrowserProfileParam `json:"profile,omitzero"`
0 commit comments