diff --git a/Dockerfile.frontend b/Dockerfile.frontend index 81b53d2..e326f35 100644 --- a/Dockerfile.frontend +++ b/Dockerfile.frontend @@ -21,7 +21,7 @@ COPY packages/ ./packages/ COPY apps/admin-web/ ./apps/admin-web/ # Build -ARG VITE_API_BASE_URL=/api +ARG VITE_API_BASE_URL= RUN pnpm --filter admin-web build # ─── Stage 2: Serve with nginx ───────────────────────────────────────────────── diff --git a/apps/admin-web/src/lib/api.ts b/apps/admin-web/src/lib/api.ts index fc1361e..8fd857e 100644 --- a/apps/admin-web/src/lib/api.ts +++ b/apps/admin-web/src/lib/api.ts @@ -130,13 +130,22 @@ import { markImageUploadRequestStarted, } from "./image-webp"; -const baseURL = import.meta.env.VITE_API_BASE_URL ?? ""; +const rawBaseURL = import.meta.env.VITE_API_BASE_URL ?? ""; +const baseURL = normalizeApiBaseURL(rawBaseURL); const generationStreamEnabled = import.meta.env.VITE_GENERATION_STREAM_ENABLED === "true"; const accessRefreshSkewMs = 2 * 60 * 1000; const publicClient = createApiClient({ baseURL }); let storedRefreshPromise: Promise | null = null; +function normalizeApiBaseURL(value: string): string { + const trimmed = value.trim().replace(/\/+$/, ""); + if (!trimmed) { + return ""; + } + return trimmed.replace(/\/api$/i, ""); +} + export function getApiBaseURL(): string { if (baseURL) { return baseURL; diff --git a/deploy/ops-config.yaml b/deploy/ops-config.yaml index 46d7cdb..05dee13 100644 --- a/deploy/ops-config.yaml +++ b/deploy/ops-config.yaml @@ -23,7 +23,7 @@ monitoring_database: max_idle_conns: 2 redis: - addr: localhost:6379 + addr: redis:6379 db: 0 cache: