Repository navigation
fix: expose browser CDP on the compose network (9223) - #99
Merged
Merged
Conversation
Chromium binds DevTools to 127.0.0.1:9222 and ignores --remote-debugging-address. Proxy that port through the existing Selkies nginx on 0.0.0.0:9223 so other containers can call /json/version without publishing CDP on the host. Co-authored-by: Andras Bacsai <andrasbacsai@users.noreply.github.com>
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.
Fixes #45
Chromium in
coollabsio/openclaw-browserignores--remote-debugging-addressand binds the DevTools port to127.0.0.1:9222. Other containers cannot openhttp://browser:9222/json/version, so the browser tool stayscdpReady=false.The image already tried to work around that with a second nginx on 9223. That process does not stay up: Selkies'
svc-nginxkills every nginx it finds, and both masters use/run/nginx.pid.This change adds a server to the existing nginx. It listens on
0.0.0.0:9223inside the container and proxies to127.0.0.1:9222, rewritingHosttolocalhostso Chrome accepts the request. Compose does not publish 9222 or 9223, so CDP stays on the compose network. The image also passes--remote-debugging-port=9222itself;CHROME_CLIcan still override it.SSRF policy for private hostnames (#64) is unchanged.
Test
Built
openclaw-browser:localfromDockerfile.browserand started it with the compose environment (CHROME_CLI=--remote-debugging-port=9222,shm_size=2g) on a user-defined network, with no published ports.From a second container on that network:
curl http://browser:9223/json/versionreturned HTTP 200 and Chrome/155.0.8059.39 JSON (Browser,Protocol-Version,webSocketDebuggerUrl).curl http://browser:9222/json/versionwas connection refused.Inside the browser container,
ssshowed127.0.0.1:9222(Chromium) and0.0.0.0:9223(the same nginx that also serves the desktop on 3000).curl http://127.0.0.1:9222/json/versionsucceeded.docker portwas empty.