What is a Transport?
ATransport is a reusable network context handle for transport level settings such as browser profile, OS emulation, proxy, and TLS verification options.
Use it when you want reusable transport settings without creating a full session per proxy, for example when you keep one transport handle per proxy in a long running worker.
createTransport()
Create a reusable transport.Signature
Options
Proxy URL for all requests made through this transport. Support depends on the native layer and proxy scheme.
Browser fingerprint profile to use for this transport.
Operating system to emulate for this transport.
When
true, accepts invalid/self-signed certificates. Use only if you understand the security tradeoffs.Native transport idle timeout option (ms).
Native transport per host idle connection limit option.
Native transport total connection limit option.
TCP connect timeout (ms).
Read timeout (ms).
Using a transport with fetch()
Pass the transport viaRequestInit.transport.
Important: request options that become invalid
When you providetransport, you must not also set browser, os, proxy, or insecure on that request. Those settings are owned by the transport.
Thousands of proxies: recommended pattern
Create one transport per proxy, reuse it for all requests that should go through that proxy, and close transports when you no longer need them.Transport lifecycle
transport.close()
Always close transports you create.transport.closed becomes true and the transport can no longer be used.
Sharing a transport across cookie jars
If you need separate cookie jars with shared transport settings (for example, multiple sessions through the same proxy), you can pass the same transport to multipleSession.fetch() calls.