Skip to content

armgit / lyftr

Public Imported from GitHub
0

Self-hosted fitness tracker. Log workouts, track nutrition, and monitor progress. Docker deployment, mobile-friendly.

docs: clarify BACKEND_ORIGIN is a Docker service name, not a host IP (#34)

Carter35e298591fc2
diff --git a/.env.example b/.env.example
index 11fd0c9..cd63e69 100644
--- a/.env.example
+++ b/.env.example
@@ -5,6 +5,9 @@ JWT_SECRET=change-me-to-a-random-32-plus-character-string
CORS_ORIGIN=http://localhost
PORT=80
-# Where the frontend proxies /api to. Change the port if you set a custom backend
-# PORT (the value must match), e.g. BACKEND_ORIGIN=backend:3008.
+# Address the frontend's nginx proxies /api to, over the internal Docker network.
+# This MUST be the backend's Docker service name (backend) — NOT your host/LAN IP.
+# Only change the port, and only if you set a custom backend PORT, e.g. backend:3008.
+# A host IP like 192.168.1.10:3000 gives a 502 Bad Gateway: in the default compose
+# the backend's port is only exposed on the Docker network, not published to the host.
BACKEND_ORIGIN=backend:3000
diff --git a/README.md b/README.md
index 2a60434..e766055 100644
--- a/README.md
+++ b/README.md
@@ -120,7 +120,9 @@ All variables live in `.env` at the project root.
| `JWT_SECRET` | *required* | Min 32-char secret for signing tokens |
| `CORS_ORIGIN` | `http://localhost` | Comma-separated allow-list of client origins. Use `*` to allow any (the API is Bearer-token based, no cookies) |
| `PORT` | `80` | Host port for the web interface |
-| `BACKEND_ORIGIN` | `backend:3000` | `host:port` the frontend proxies `/api` to. Must match the backend's `PORT` if you change it |
+| `BACKEND_ORIGIN` | `backend:3000` | Docker **service name**:port the frontend proxies `/api` to — not a host IP. Only change the port, to match a custom backend `PORT` |
+
+> **Self-hosting note:** `BACKEND_ORIGIN` is resolved over the internal Docker network, so it must use the backend's **service name** (`backend`), not your server's host or LAN IP. The default compose only *exposes* the backend on the Docker network — it isn't published to the host — so pointing `BACKEND_ORIGIN` at something like `192.168.1.10:3000` produces a `502 Bad Gateway` (`connect() failed (111: Connection refused)`). If you set a custom backend `PORT`, change only the port (e.g. `backend:3008`).
---