Repository navigation
fix: nginx starts without a browser sidecar, and hand edits survive restart - #98
Merged
andrasbacsai merged 1 commit intoOct 19, 2026
Merged
Conversation
Resolve the browser upstream at request time so nginx boots when no sidecar exists, and write unrecognized top-level keys back after the gateway has loaded so doctor --fix can still migrate on every start. Co-authored-by: Andras Bacsai <[email protected]>
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 #39.
Related to #15. This does not claim to close #15. That issue is about restarting the gateway from inside the container. The hand-edit loss below is the same class of “config disappears on restart” report.
1. nginx starts with no
browserhostlocation /browser/usedproxy_pass http://browser:3000/, which nginx resolves at startup. A plaindocker runhas no such host, so nginx exited withhost not found in upstream "browser".The location now uses Docker’s DNS resolver and a variable
proxy_pass, so a missing sidecar returns 502 and nginx still starts./browser/stays on basic auth and is not part of the bearer bypass.docker run --add-hostonly writes/etc/hosts, which that resolver does not read, so whengetentcan already resolvebrowserthe address is pinned (compose DNS and--add-hostboth work). The/browser/prefix is stripped.2. Hand-edited top-level keys
OpenClaw 2026.10.5 validates
openclaw.jsonwithz.strictObject.openclaw doctor --fixrewrites the file through that schema and drops unrecognized keys.gateway runthen exits if an unrecognized key is still present at process start. After the gateway is listening, the same key only producesconfig reload skipped (invalid config)and the process keeps the valid config it loaded.--lintand--jsonare read-only, so they do not apply the migrations this entrypoint has always used--fixfor. Skipping doctor after the first boot also fails:configure.jsreapplies env values on every start (including a model id doctor then upgrades, such asanthropic/claude-sonnet-4-5→anthropic/claude-sonnet-4-6). Without doctor, the gateway exits on the unmigrated value.So doctor still runs on every start. Before it runs, the entrypoint snapshots the file. After the gateway is listening,
scripts/preserve-hand-edits.jswrites back only top-level keys doctor removed. Nested env-driven settings and doctor migrations stay as doctor left them.gateway.controlUi.allowInsecureAuthis no longer written. 2026.10.5 rejects that key, which is why device approval is required (below). Doctor was deleting it on every boot.3.
/__openclaw__/assistant-mediastays on the bearer bypassA request with no
Authorizationheader gets 401 Basic. A bare URL with a Bearer token and nosourceis a gateway 404, for both a bogus token and the real gateway token. That 404 is a missing-source response, not an auth grant.The Control UI does send
Authorization: Bearerto this exact path, and that request has to skip basic auth or nginx re-prompts:?meta=1) inui/src/e2e/chat-flow.local-media-policy.e2e.test.ts(OpenClaw v2026.10.5) expectsBearerand expects the follow-up media bytes to usemediaTicketwith noAuthorizationheaderui/src/components/browser/browser-client.ts(fetchBrowserScreenshotDataUrl) andui/src/components/browser/browser-panel-download.tsTicketed image/audio requests have no Bearer header, so they still require basic auth. The bypass map only skips auth when the header is Bearer and the path matches.
4. README
wss://URL andOPENCLAW_GATEWAY_TOKEN, then Approve this browser, thenopenclaw devices listandopenclaw devices approve <requestId>. With no id, approve only previews and exits 1. Once per browser profile.0 * * * *), not every 6 hours.Verification
Image built as CI does:
Dockerfile.basethenDockerfile,OPENCLAW_GIT_REF=v2026.10.5(OpenClaw 2026.10.5 (1b58cb9)).node scripts/utils.test.js— 292 passednode scripts/nginx-bearer.test.js— 80 passed/is 401 without credentials and 200OpenClaw Controlwith basic auth,/browser/with auth is 502, nginx stays up--add-host browser:127.0.0.1: upstream pinned to127.0.0.1:3000,/browser/foois 401 without auth andpath=/foowith authdocker restart:x-hand-editis restored after the gateway listens,gateway.auth.tokenis still the env token, allowed origins still match the env, container stays up (config reload skipped (invalid config): Unrecognized key: "x-hand-edit")/__openclaw__/assistant-mediawith no credentials is 401WWW-Authenticate: Basic401responses withWWW-Authenticate: Basic, and no auth dialog