Use VPC Networks in a Worker
VPC network bindings that route traffic through a Cloudflare Tunnel or a network ID.
Add the VPC Networks config, call a VPC network from worker code, and start with the local test path Devflare supports.
Start with the config, wire the binding into worker code, then use the support section to decide whether local tests or Cloudflare-backed tests fit.
- Config key
- Authoring shape
- Best for
- routing Worker traffic through a Cloudflare Tunnel or a private network ID
Use the binding from application code
After Devflare generates the worker env, import from and keep the first VPC Networks path close to the route, handler, or service method that needs it.
Keep this first path small enough that the config, env binding, and user-visible behavior are easy to review together.
Route a request through the VPC network
Local and Remote Support
Devflare supports the config, generated env shape, docs, and local application-flow work, but full fidelity requires Cloudflare remote infrastructure. Use local shims or fixtures for code your app owns, then connect to Cloudflare when the product behavior is the assertion.
Remote boundary: Miniflare wires VPC networks only as a remote proxy client, so there is no offline simulation. Keep local coverage focused on deterministic application flow through fixtures, mocks, shims, or Miniflare-backed wiring instead of pretending to reproduce Cloudflare-hosted product behavior.
Use Cloudflare when the assertion depends on cloudflare-hosted product behavior rather than the app calling the binding correctly. This is the lane for full VPC Networks product fidelity, remote state, lifecycle behavior, and platform-specific limits.
When this binding fits best
- Use VPC Networks when routing worker traffic through a cloudflare tunnel or a private network id.
- Keep binding names stable and uppercase in examples so generated Env declarations remain predictable.
- Prefer Devflare native config while it covers the feature; use only for unsupported Wrangler-only fields.
Testing path
- Start with a deployed or remote-mode test against the real VPC network for config-backed local worker tests.
- Use a custom fake binding injected through for small unit tests that only need deterministic application behavior.
- Use Cloudflare-backed tests when the assertion depends on hosted platform behavior, account state, limits, billing, or production routing.
Open the next page when you need it
Subpage
VPC Networks internals
InternalsCheck emitted Wrangler , preview behavior, and Cloudflare-specific details.
Subpage
Testing VPC Networks
TestingPick the a deployed or remote-mode test against the real VPC network path first, then move to remote checks only when the test needs them.
Subpage
VPC Networks example
ExampleCopy a fuller application path when the quick example is too small.