Skip to content

Add opt-in BACKEND_HOST knob for network-wide backend bind - #28

Open
dokterbob wants to merge 1 commit into
PrismML-Eng:mainfrom
dokterbob:backend-host-opt-in
Open

Add opt-in BACKEND_HOST knob for network-wide backend bind#28
dokterbob wants to merge 1 commit into
PrismML-Eng:mainfrom
dokterbob:backend-host-opt-in

Conversation

@dokterbob

Copy link
Copy Markdown

Summary

  • Backend still defaults to loopback-only (127.0.0.1), matching current behavior — default runs are unaffected.
  • New opt-in BACKEND_HOST env var (mirrors the existing send_request.sh naming) lets you bind the backend wide, e.g. BACKEND_HOST=0.0.0.0 ./scripts/serve.sh.
  • Prints a clear warning when opted into a non-loopback host, since neither backend variant (local_backend.py on Linux, local_backend_mac.py wrapping backend/server.py on macOS) has auth enabled in this demo.
  • The frontend was already reachable from other machines with no code change (Next.js binds all interfaces by default when -H is omitted) — added a comment near its launch so this isn't "fixed" by accident later.
  • Closing summary now prints the external frontend/backend URLs (best-effort IP detection via new host_ip() helper in common.sh), gated behind the opt-in so default output is byte-for-byte unchanged.

Test plan

  • sh -n scripts/serve.sh / sh -n scripts/common.sh — syntax OK
  • ./scripts/serve.sh with no overrides — no warning, no network-access section, backend binds 127.0.0.1:8000
  • BACKEND_HOST=0.0.0.0 ./scripts/serve.sh — warning prints, lsof shows *:8000, summary prints resolved network URLs
  • BACKEND_HOST=localhost / BACKEND_HOST=::1 — no warning, no network-access section
  • Cross-check with BACKEND_HOST=<host-IP> ./scripts/send_request.sh -p "..." against a wide-bound backend

🤖 Generated with Claude Code

The backend defaults to loopback-only (matches prior behavior). Setting
BACKEND_HOST=0.0.0.0 makes it reachable from other machines and now
prints a clear warning, since neither backend variant has auth enabled
in this demo. The frontend was already reachable from other machines
with no code change; the closing summary now surfaces its external URL
when BACKEND_HOST is opted in.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant