chore(dev): use host.docker.internal instead of hardcoded LAN IPs#3116
Merged
chore(dev): use host.docker.internal instead of hardcoded LAN IPs#3116
Conversation
Sandbox containers running under Docker Desktop resolve host.docker.internal to the host machine, so the prior hardcoded LAN IP workarounds are unnecessary. Replace them in gastown wrangler dev vars, cloud-agent(-next) WS_ALLOWED_ORIGINS, and the cloud-agent(-next) .dev.vars.example files. Drop the stale comment that referenced a workerd-network limitation; that issue relates to Hyperdrive, not Sandbox containers.
Revert host.docker.internal changes from gastown and legacy cloud-agent services. Keep them only for cloud-agent-next where Sandbox containers actually need them. Add env-sync script logic to preserve host.docker.internal in @url annotations when the .dev.vars.example default explicitly uses it, so pnpm dev:env won't overwrite it with the LAN IP.
Contributor
Author
Code Review SummaryStatus: 1 Issue Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
Other Observations (not in diff)Issues found in unchanged code that cannot receive inline comments:
Files Reviewed (4 files)
Reviewed by gpt-5.5-2026-04-23 · 396,311 tokens |
jeanduplessis
approved these changes
May 7, 2026
Contributor
jeanduplessis
left a comment
There was a problem hiding this comment.
Approved. One non-blocking edge-case opportunity remains around keeping the generated .dev.vars WS_ALLOWED_ORIGINS path aligned with the new host.docker.internal wrangler dev origin; I did not add a duplicate inline comment because an existing review thread already covers that path.
Contributor
|
WS_ALLOWED_ORIGINS is for clients outside of docker to connect to services, I don't think there is a need to handle docker's internal host there 🤔 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The dev configs in this repo previously hardcoded LAN IPs (
192.168.65.254,192.168.200.x) so that Cloudflare Sandbox containers could reach host services like Next.js on :3000.Sandbox containers run on the Docker Desktop bridge and do resolve
host.docker.internalto the host. This PR switchescloud-agent-nextto usehost.docker.internalin its.dev.vars.exampleandwrangler.jsonc(WS_ALLOWED_ORIGINS).It also fixes the env-sync script (
dev/local/env-sync/parse.ts) so thatpnpm dev:envpreserveshost.docker.internalwhen the.dev.vars.exampledefault explicitly uses it, instead of overwriting it with the LAN IP. A test is added for this behaviour.Gastown and the legacy
cloud-agentservice keep their existing LAN-IP-based dev configs — those services have different networking constraints and weren't part of this change.Verification
pnpm dev:env cloud-agentand confirm.dev.varskeepshost.docker.internalforKILOCODE_BACKEND_BASE_URL,WORKER_URL, etc./ingestwithout manually overriding.dev.vars.Visual Changes
N/A
Reviewer Notes
host.docker.internalonly works inside Docker Desktop containers (Linux VM on macOS/Windows). The Sandbox container runtime uses Docker Desktop, so this is the correct host alias.@urlannotations: if the example default containshost.docker.internal, the generated value preserves that hostname while still updating the port fromservices.ts..dev.vars.exampletemplates, or the local env-sync tool.