{"record":{"id":"c39ecea2cee567ad","repo":"Mintplex-Labs/anything-llm","slug":"please-open-this-page-via-your-machines-private-ip","errorCode":null,"errorMessage":"Please open this page via your machines private IP address or custom domain. Localhost URLs will not work with the mobile app.","messagePattern":"Please open this page via your machines private IP address or custom domain\\. Localhost URLs will not work with the mobile app\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"frontend/src/pages/GeneralSettings/MobileConnections/ConnectionModal/index.jsx","lineNumber":106,"sourceCode":"function processConnectionUrl(url) {\n  /*\n   * In dev mode, the connectionURL() method uses the `ip` module\n   * see server/models/mobileDevice.js `connectionURL()` method.\n   *\n   * In prod mode, this method returns the absolute path since we will always want to use\n   * the real instance hostname. If the domain changes, we should be able to inherit it from the client side\n   * since the backend has no knowledge of the domain since typically it is run behind a reverse proxy or in a container - or both.\n   * So `ip` is useless in prod mode since it would only resolve to the internal IP address of the container or if non-containerized,\n   * the local IP address may not be the preferred instance access point (eg: using custom domain)\n   *\n   * If the url does not start with http, we assume it is a relative path and add the origin to it.\n   * Then we check if the hostname is localhost, 127.0.0.1, or 0.0.0.0. If it is, we throw an error since that is not\n   * a LAN resolvable address that other devices can use to connect to the instance.\n   */\n  if (url.startsWith(\"http\")) return new URL(url);\n  const connectionUrl = new URL(`${window.location.origin}${url}`);\n  if ([\"localhost\", \"127.0.0.1\", \"0.0.0.0\"].includes(connectionUrl.hostname))\n    throw new Error(\n      \"Please open this page via your machines private IP address or custom domain. Localhost URLs will not work with the mobile app.\"\n    );\n  return connectionUrl.toString();\n}\n\nconst ConnectionQrCode = ({ isOpen }) => {\n  const [connectionInfo, setConnectionInfo] = useState(null);\n  const [isLoading, setIsLoading] = useState(false);\n  const [error, setError] = useState(null);\n\n  useEffect(() => {\n    if (!isOpen) return;\n    setIsLoading(true);\n    MobileConnection.getConnectionInfo()\n      .then((res) => {\n        if (res.error) throw new Error(res.error);\n        const url = processConnectionUrl(res.connectionUrl);\n        setConnectionInfo(url);","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/20f6d3546c1938bfea1ad304f58a592dddcc5948/frontend/src/pages/GeneralSettings/MobileConnections/ConnectionModal/index.jsx#L88-L124","documentation":"ConnectionModal builds the URL encoded into the mobile-app QR code. Relative storage URLs are resolved against window.location.origin, and if the hostname is localhost, 127.0.0.1, or 0.0.0.0 it throws, because a phone on the LAN cannot reach a loopback address — the QR code would encode an unreachable target.","triggerScenarios":"Opening the mobile connection modal while the frontend is served from http://localhost:PORT, http://127.0.0.1:PORT, or http://0.0.0.0:PORT; any relative path resolved against one of those origins.","commonSituations":"Developer opens the UI via localhost during testing; Docker ports published but accessed through localhost; reverse proxy misconfigured so the browser origin stays localhost instead of the custom domain.","solutions":["Open the frontend via the machine's LAN IP (e.g. http://192.168.1.20:3000) and reopen the modal.","Or access the instance through its custom domain so the origin is LAN/public resolvable.","Ensure the server binds an interface reachable from the phone and the firewall allows that port.","For containerized deployments, publish the port and connect to the host's LAN IP, not localhost."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"function isLanResolvable(origin = window.location.origin) {\n  const host = new URL(origin).hostname;\n  return !['localhost', '127.0.0.1', '0.0.0.0'].includes(host);\n}\n// Before opening the connection modal:\nif (!isLanResolvable()) {\n  showNotice('Reopen this page via your machine IP or domain to connect the mobile app.');\n}","typeGuard":null,"tryCatchPattern":"try {\n  const connectionUrl = buildConnectionUrl(relativePath);\n} catch (error) {\n  // Intentional guard: explain how to reopen, do not retry\n  setError('Open this page via your private IP or custom domain — localhost cannot be reached by the mobile app.');\n}","preventionTips":["Access the admin UI via the machine's LAN IP or custom domain from the start during mobile setup.","Publish container ports and test with the host LAN address before generating QR codes.","Make reverse proxy preserve a public hostname so the browser origin is never localhost."],"tags":["mobile-app","qr-code","localhost","networking","lan"],"backgroundTag":"localhost-url-unreachable","analyzedSha":"20f6d3546c1938bfea1ad304f58a592dddcc5948","analyzedAt":"2026-08-18T10:02:21.017Z","contentChangedAt":"2026-08-18T10:02:21.017Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}