import type { NextConfig } from "next"; const nextConfig: NextConfig = { output: "standalone", turbopack: { root: __dirname, }, async rewrites() { const apiBase = process.env.NEXT_PUBLIC_API_URL || "http://localhost:8080"; return [ { source: "/api/:path*", destination: `${apiBase}/api/:path*`, }, { // Unauthenticated public share endpoints live at the backend's // /public/* routes (NOT under /api, and without the auth middleware — // see internal/api/public_share_handlers.go). They are proxied under a // distinct /public/api/* prefix so they never collide with the // human-facing Next.js page at /public/share/[token]. source: "/public/api/:path*", destination: `${apiBase}/public/:path*`, }, ]; }, }; export default nextConfig;