Skip to content

containers: Add container and test Containers interceptOutboundHttp#12649

Merged
emily-shen merged 6 commits intomainfrom
gv/containers-set-egress
Mar 3, 2026
Merged

containers: Add container and test Containers interceptOutboundHttp#12649
emily-shen merged 6 commits intomainfrom
gv/containers-set-egress

Conversation

@gabivlj
Copy link
Contributor

@gabivlj gabivlj commented Feb 23, 2026

Adds configuration backed by a experimental flag to allow direct communication to Workers from Containers.

There is an example in the integration test, how this feature works is that you can now define a HTTP IP:port mapping to a WorkerEntrypoint. All requests done in the container to that endpoint end up spawning a Worker to serve the request.

To enable this feature, use the experimental flag experimental in the configuration.

export class TestService extends WorkerEntrypoint {
  async fetch(req: Request) {
    return new Response("hello from worker");
  }
}

...

await this.container.interceptOutboundHttp(
  "11.0.0.1:80",
  this.ctx.exports.TestService({ props: {} }),
);


... inside container

console.log(await (await fetch('11.0.0.1:80')).text()); // hello from worker										);

You can also use the very convenient:

this.ctx.container.interceptAllOutboundHttp(this.ctx.exports.TestService({ props: {} }))

It won't work with HTTPS yet, of course. Stay tuned for that.

Note: This feature is experimental and subject to change.


  • Tests
    • Tests included/updated
    • Automated tests not possible - manual testing has been completed as follows:
    • Additional testing not necessary because:
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: Experimental feature for now that we are testing. Once preparation for GA begins, we will add public cloudflare-docs

A picture of a cute animal (not mandatory, but encouraged)
image

@gabivlj gabivlj requested review from a team as code owners February 23, 2026 20:15
@changeset-bot
Copy link

changeset-bot bot commented Feb 23, 2026

🦋 Changeset detected

Latest commit: ee032d7

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

devin-ai-integration[bot]

This comment was marked as resolved.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 23, 2026

create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@12649

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@12649

miniflare

npm i https://pkg.pr.new/miniflare@12649

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@12649

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@12649

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@12649

@cloudflare/vitest-pool-workers

npm i https://pkg.pr.new/@cloudflare/vitest-pool-workers@12649

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@12649

@cloudflare/workers-utils

npm i https://pkg.pr.new/@cloudflare/workers-utils@12649

wrangler

npm i https://pkg.pr.new/wrangler@12649

commit: 51c3b36

@claude
Copy link
Contributor

claude bot commented Feb 23, 2026

Claude finished @gabivlj's task —— View job


Changeset Review

✅ All changesets look good

The changeset in .changeset/empty-radios-happen.md follows all the guidelines:

  • Version Type: Correctly marked as minor for a new experimental feature
  • Changelog Quality: Clear description with explanation of the feature and explicit note about experimental status requiring a flag
  • Markdown Headers: No h1/h2/h3 headers present
  • Experimental Feature Note: ✅ Includes note on how users can opt in ("requires enabling the 'experimental' flag")

This is a polar bear. Very close to the camera. Doing a heckin good sniff. Magnificent snoot. 14/10 would definitely not try to pet.

@gabivlj gabivlj force-pushed the gv/containers-set-egress branch 2 times, most recently from 9a0ba3f to ac8c8f6 Compare February 23, 2026 20:40
ichernetsky-cf
ichernetsky-cf previously approved these changes Feb 23, 2026
@gabivlj gabivlj force-pushed the gv/containers-set-egress branch from a1f1fa4 to 21213a3 Compare February 23, 2026 21:19
devin-ai-integration[bot]

This comment was marked as resolved.

@gabivlj gabivlj force-pushed the gv/containers-set-egress branch 3 times, most recently from 7e0dafc to 3a03fb4 Compare February 24, 2026 18:50
devin-ai-integration[bot]

This comment was marked as resolved.

@gabivlj gabivlj force-pushed the gv/containers-set-egress branch 5 times, most recently from 4e9cd56 to 38fce29 Compare February 26, 2026 21:40
devin-ai-integration[bot]

This comment was marked as resolved.

@gabivlj gabivlj force-pushed the gv/containers-set-egress branch from 38fce29 to 1bf6fa5 Compare February 27, 2026 17:28
@github-actions
Copy link
Contributor

github-actions bot commented Feb 27, 2026

⚠️ Issues found

File: .changeset/empty-radios-happen.md

Issue: Insufficient opt-in instructions for experimental feature

The changeset correctly uses minor for an experimental feature and mentions that a compatibility flag is required, but the description does not specify which compatibility flag users need to add. Per the README guidelines, experimental features should explicitly call out how users can opt in.

The current description says:

"This feature is experimental and requires adding the 'experimental' compatibility flag to your Wrangler configuration."

This is too vague. The changeset should name the specific compatibility flag (e.g. "experimental_containers_intercept_outbound_http" or whatever the actual flag name is) and ideally include a brief wrangler.json example showing how to enable it.

Suggested improvement:

Add experimental support for containers to workers communication with interceptOutboundHttp

This feature is experimental. To opt in, add the `<specific-flag-name>` compatibility flag to your `wrangler.json`:

```json
{
  "compatibility_flags": ["<specific-flag-name>"]
}

Please update the changeset to include the specific flag name and a configuration example.

<!-- Sticky Pull Request Commentchangeset-review -->

@gabivlj gabivlj force-pushed the gv/containers-set-egress branch from 1bf6fa5 to 2ded211 Compare February 27, 2026 17:31
emily-shen
emily-shen previously approved these changes Mar 2, 2026
Copy link
Contributor

@emily-shen emily-shen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and i've manually tested this on macOS and it works great 🎉

@github-project-automation github-project-automation bot moved this from Untriaged to Approved in workers-sdk Mar 2, 2026
@gabivlj gabivlj force-pushed the gv/containers-set-egress branch 2 times, most recently from 2fe4952 to e766863 Compare March 2, 2026 17:43
@workers-devprod workers-devprod dismissed stale reviews from emily-shen and ichernetsky-cf March 2, 2026 17:43

Changes in owned files since last approval

@workers-devprod
Copy link
Contributor

workers-devprod commented Mar 2, 2026

Codeowners approval required for this PR:

  • ✅ @cloudflare/cloudchamber
  • ✅ @cloudflare/wrangler
Show detailed file reviewers

emily-shen
emily-shen previously approved these changes Mar 2, 2026
@gabivlj gabivlj force-pushed the gv/containers-set-egress branch from e766863 to ee032d7 Compare March 2, 2026 20:23
@workers-devprod workers-devprod dismissed emily-shen’s stale review March 2, 2026 20:23

Changes in owned files since last approval

@emily-shen emily-shen merged commit 35b2c56 into main Mar 3, 2026
56 of 66 checks passed
@emily-shen emily-shen deleted the gv/containers-set-egress branch March 3, 2026 10:32
@github-project-automation github-project-automation bot moved this from Approved to Done in workers-sdk Mar 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants