[PR #6158] fix(app): use window.location.origin for API URL fallback #11755

Closed
opened 2026-02-16 18:16:41 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/6158

State: closed
Merged: No


Summary

  • Fix web UI failing when accessed via non-localhost addresses (Tailscale IP, LAN IP, custom hostname)
  • Change API URL fallback from hardcoded http://localhost:4096 to window.location.origin

Problem

When running opencode serve --hostname=0.0.0.0 and accessing via a network IP (e.g., http://192.168.1.100:4096), the frontend was hardcoded to make API requests to http://localhost:4096, which doesn't exist on the remote machine.

Solution

Use window.location.origin as the fallback, which dynamically resolves to the actual server address.

Fixes #5844
Fixes #6063

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/6158 **State:** closed **Merged:** No --- ## Summary - Fix web UI failing when accessed via non-localhost addresses (Tailscale IP, LAN IP, custom hostname) - Change API URL fallback from hardcoded `http://localhost:4096` to `window.location.origin` ## Problem When running `opencode serve --hostname=0.0.0.0` and accessing via a network IP (e.g., `http://192.168.1.100:4096`), the frontend was hardcoded to make API requests to `http://localhost:4096`, which doesn't exist on the remote machine. ## Solution Use `window.location.origin` as the fallback, which dynamically resolves to the actual server address. Fixes #5844 Fixes #6063
yindo added the pull-request label 2026-02-16 18:16:41 -05:00
yindo closed this issue 2026-02-16 18:16:42 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#11755