Set PUBLIC_API_URL at build time for production
Vite inlines import.meta.env.PUBLIC_* at build time, not runtime. Without this, the frontend falls back to localhost:8099 which doesn't exist from the browser. Empty string means same-origin requests, letting Caddy route /api/* to the backend.
This commit is contained in:
parent
fb5b911ea1
commit
9b2737ef77
@ -24,6 +24,12 @@ RUN npm ci
|
||||
COPY . .
|
||||
|
||||
ENV ASTRO_TELEMETRY_DISABLED=1
|
||||
|
||||
# PUBLIC_API_URL must be set at build time for Vite to inline it.
|
||||
# Empty string = same-origin (Caddy routes /api/* to backend).
|
||||
ARG PUBLIC_API_URL=""
|
||||
ENV PUBLIC_API_URL=${PUBLIC_API_URL}
|
||||
|
||||
RUN npm run build
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user