Mintplex-Labs/anything-llm · warning · Error
Please open this page via your machines private IP address o
Error message
Please open this page via your machines private IP address or custom domain. Localhost URLs will not work with the mobile app.
What it means
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.
Source
Thrown at frontend/src/pages/GeneralSettings/MobileConnections/ConnectionModal/index.jsx:106
function processConnectionUrl(url) {
/*
* In dev mode, the connectionURL() method uses the `ip` module
* see server/models/mobileDevice.js `connectionURL()` method.
*
* In prod mode, this method returns the absolute path since we will always want to use
* the real instance hostname. If the domain changes, we should be able to inherit it from the client side
* since the backend has no knowledge of the domain since typically it is run behind a reverse proxy or in a container - or both.
* So `ip` is useless in prod mode since it would only resolve to the internal IP address of the container or if non-containerized,
* the local IP address may not be the preferred instance access point (eg: using custom domain)
*
* If the url does not start with http, we assume it is a relative path and add the origin to it.
* 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
* a LAN resolvable address that other devices can use to connect to the instance.
*/
if (url.startsWith("http")) return new URL(url);
const connectionUrl = new URL(`${window.location.origin}${url}`);
if (["localhost", "127.0.0.1", "0.0.0.0"].includes(connectionUrl.hostname))
throw new Error(
"Please open this page via your machines private IP address or custom domain. Localhost URLs will not work with the mobile app."
);
return connectionUrl.toString();
}
const ConnectionQrCode = ({ isOpen }) => {
const [connectionInfo, setConnectionInfo] = useState(null);
const [isLoading, setIsLoading] = useState(false);
const [error, setError] = useState(null);
useEffect(() => {
if (!isOpen) return;
setIsLoading(true);
MobileConnection.getConnectionInfo()
.then((res) => {
if (res.error) throw new Error(res.error);
const url = processConnectionUrl(res.connectionUrl);
setConnectionInfo(url);View on GitHub (pinned to 20f6d3546c)
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.
Defensive patterns
Strategy: validation
Validate before calling
function isLanResolvable(origin = window.location.origin) {
const host = new URL(origin).hostname;
return !['localhost', '127.0.0.1', '0.0.0.0'].includes(host);
}
// Before opening the connection modal:
if (!isLanResolvable()) {
showNotice('Reopen this page via your machine IP or domain to connect the mobile app.');
} Try / catch
try {
const connectionUrl = buildConnectionUrl(relativePath);
} catch (error) {
// Intentional guard: explain how to reopen, do not retry
setError('Open this page via your private IP or custom domain — localhost cannot be reached by the mobile app.');
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
AI-assisted analysis of Mintplex-Labs/anything-llm@20f6d3546c (2026-08-18).
Data as JSON: /api/errors/c39ecea2cee567ad.
Report an issue: GitHub.