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
25 lines
946 B
JavaScript
25 lines
946 B
JavaScript
import createNextIntlPlugin from "next-intl/plugin";
|
|
|
|
// The dashboard talks to the API through its own origin (/api/*), so the
|
|
// httpOnly session cookie is always first-party: it works on localhost,
|
|
// 127.0.0.1, a LAN address or a real domain alike, without CORS. The
|
|
// target is baked into the build (standalone output); compose passes the
|
|
// in-network address, `next dev` defaults to a local API.
|
|
const apiProxyTarget = (process.env.API_PROXY_TARGET || "http://localhost:8000").replace(/\/$/, "");
|
|
|
|
/** @type {import('next').NextConfig} */
|
|
const nextConfig = {
|
|
output: "standalone",
|
|
async rewrites() {
|
|
return [{ source: "/api/:path*", destination: `${apiProxyTarget}/:path*` }];
|
|
},
|
|
experimental: {
|
|
// Uploads and transcript downloads can outlast the 30 s proxy default.
|
|
proxyTimeout: 10 * 60 * 1000,
|
|
},
|
|
};
|
|
|
|
const withNextIntl = createNextIntlPlugin("./src/i18n/request.ts");
|
|
|
|
export default withNextIntl(nextConfig);
|