Skip to content

Connect OpenCode Mobile Through a Reverse Proxy or API Prefix

OpenCode Mobile accepts a base URL with a prefix, for example:

https://dev.example.com/api

With that setting, health and session calls stay under the prefix, such as:

https://dev.example.com/api/global/health

Terminal WebSockets also preserve the prefix and switch to wss: for HTTPS endpoints.

  • / serves a web application instead of the OpenCode API
  • A proxy mounts OpenCode under /api or another subpath
  • The app reports that the server returned HTML, a JSON parse error, 404, or another non-API response

Do not append /api blindly. Verify the resulting /global/health endpoint first.

A reverse proxy must forward ordinary HTTP requests, server-sent events (SSE), and terminal WebSockets. If streaming or WebSocket upgrades are dropped, tasks appear to stall or the terminal fails while the browser UI still works.

Read the remote-access security model first. Use HTTPS, require OpenCode authentication, and avoid exposing an unauthenticated server.

For other routes, return to the remote-access overview or use the troubleshooting checklist.