diff --git a/.env.example b/.env.example index dd95da2b..1bd84acf 100644 --- a/.env.example +++ b/.env.example @@ -1,11 +1,12 @@ # API Configuration # Copy this file to .env and update with your actual values -# Backend API base URL (Vite proxy uses /api in development) +# Backend API base URL (Ky prefixUrl). API route paths do NOT include /api — it comes from here. +# Development: use /api (Vite proxies /api to VITE_API_TARGET) #VITE_API_URL=/api -# For production, update to your production API URL -VITE_API_URL=https://api.seahavenindustries.com +# Production: absolute URLs MUST include the /api path segment +VITE_API_URL=https://api.seahavenindustries.com/api # Development proxy target (used by vite.config.ts) #VITE_API_TARGET=http://localhost:5141 diff --git a/README.md b/README.md index db722ee4..c5d10b6f 100644 --- a/README.md +++ b/README.md @@ -16,10 +16,17 @@ cp .env.example .env ### Environment variables -| Variable | Description | Default | -| ----------------- | ------------------------------------------------------ | ----------------------- | -| `VITE_API_URL` | Backend API base URL (baked into the production build) | `/api` | -| `VITE_API_TARGET` | Dev proxy target for `/api` (Vite only) | `http://localhost:5141` | +| Variable | Description | Default | +| ----------------- | ----------------------------------------------- | ----------------------- | +| `VITE_API_URL` | Ky API prefix (baked into the production build) | `/api` | +| `VITE_API_TARGET` | Dev proxy target for `/api` (Vite only) | `http://localhost:5141` | + +`VITE_API_URL` is the full API base prefix. Route paths in `API_PATHS` do **not** include `/api` — only this variable supplies it. + +- **Development:** use `VITE_API_URL=/api`. The Vite dev server proxies `/api` to `VITE_API_TARGET`. +- **Production:** use an absolute URL that **ends with `/api`** (e.g. `https://api.example.com/api`). Absolute URLs without `/api` will produce broken API requests. + +See [`.env.example`](.env.example) and [`.env.production`](.env.production) for reference values. ## Scripts