Files
ahp 9a74cca685 fix(web): reach the API through the dashboard's own origin
Signing in returned 200, but the browser never sent the session cookie
back, so every following request was a 401. The dashboard called the API
on another origin (http://localhost:8000): opened as 127.0.0.1:3000 or a
LAN address that is a different site, so the SameSite cookie was never
stored, and browsers also drop a Secure cookie over plain http.

- the web server proxies /api/* to API_PROXY_TARGET (http://api:8000 in
  compose) and the client calls /api by default, so the cookie is
  first-party on any host; NEXT_PUBLIC_API_BASE is now only for an API
  on its own host
- /api is excluded from the locale middleware, and the proxy timeout is
  raised to 10 minutes for large uploads and downloads
- AUTH_COOKIE_SECURE defaults to auto: Secure whenever the request came
  over HTTPS, directly or via X-Forwarded-Proto; true/false force it
- .env.example, compose, both READMEs and the CHANGELOG updated
2026-11-26 18:42:01 +03:30

34 lines
866 B
Docker

FROM node:22-alpine AS build
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci
COPY . .
# Both are baked into the build. The browser calls the API through this
# app's own /api path, proxied to API_PROXY_TARGET (the compose service by
# default). NEXT_PUBLIC_API_BASE stays empty unless the API is served from
# its own host.
ARG NEXT_PUBLIC_API_BASE=
ARG API_PROXY_TARGET=http://api:8000
ENV NEXT_PUBLIC_API_BASE=$NEXT_PUBLIC_API_BASE
ENV API_PROXY_TARGET=$API_PROXY_TARGET
RUN npm run build
FROM node:22-alpine
WORKDIR /app
ENV NODE_ENV=production
COPY --from=build /app/.next/standalone ./
COPY --from=build /app/.next/static ./.next/static
COPY --from=build /app/public ./public
# Next.js standalone ships a stock `node` user (uid 1000); the server binds
# 3000 and writes nothing at runtime.
USER node
EXPOSE 3000
CMD ["node", "server.js"]