the anthropic proxy binds PORT + 1
ANTHROPIC_PROXY_PORT is gone. It was 5051 hardcoded in four files: proxy.ts, which binds it, and three others that guessed the same constant to find it. It is the only sidecar that binds a fixed port, and that part is a real constraint rather than an oversight. Every other one binds `port: 0`, lets the kernel choose and reports back over the registration socket — which works because their consumer is the platform. The proxy's consumer is `claude`, spawned by a different pm2 process that needs ANTHROPIC_BASE_URL at spawn time and has no channel to ask what port the proxy landed on. Two processes with nothing between them have to agree in advance. So the number must be predictable, but it need not be 5051 — a value chosen against nothing, in the registered range, free to collide with anything the owner installs later. The symptom of that collision would have been chat failing while the rest of the platform looked healthy. PORT + 1 keeps the predictability and drops both the constant and the variable. Nothing to set, no second number to keep in agreement with the first, and the pair moves together when the install moves. Also corrects .env.example, which said the proxy "holds the API credential, which lives in the host env". It does not. The upstream credential is the OAuth token claude writes to ~/.claude/.credentials.json, and the ANTHROPIC_API_KEY the agent presents is the proxy's own generated secret. Verified the derivation at PORT=9000 and PORT=10000; all four consumers now import it; every edited file parses. Still not typechecked — empty node_modules, frozen installs. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
+4
-3
@@ -61,9 +61,10 @@ ALLOW_ANY_ORIGIN=true
|
||||
# key, not Vaultwarden's, however much the name and its old position here suggested otherwise.
|
||||
VAULTWARDEN_URL=http://127.0.0.1:8222
|
||||
|
||||
# Anthropic proxy (officer-anthropic-proxy). Defaults to 5051; it holds the API credential, which
|
||||
# lives in the host env rather than here.
|
||||
# ANTHROPIC_PROXY_PORT=5051
|
||||
# The Anthropic proxy (officer-anthropic-proxy) binds PORT + 1, derived rather than configured — see
|
||||
# src/servers/officer-url.mjs. There is nothing to set. It holds no credential from this file either:
|
||||
# the upstream token is the OAuth one `claude` writes to ~/.claude/.credentials.json, and the
|
||||
# ANTHROPIC_API_KEY the agent presents to it is the proxy's own generated secret.
|
||||
|
||||
# ReClip — the self-hosted yt-dlp service the download-media capability talks to. Defaults to
|
||||
# http://localhost:8899.
|
||||
|
||||
Reference in New Issue
Block a user