diff --git a/apps/web/next.config.ts b/apps/web/next.config.ts index f325f26..8545cb5 100644 --- a/apps/web/next.config.ts +++ b/apps/web/next.config.ts @@ -75,6 +75,16 @@ export default function nextConfig(phase: string): NextConfig { // hot reload and other /_next/* dev requests from an origin it is not told // about. These are the preview's hosts, prod's and stage's. allowedDevOrigins: ["*.orun-preview.app", "preview-gateway-stage.oruncloud.workers.dev"], + experimental: { + // Dev server only: behind orun.work's live Preview the browser's Origin + // is the preview's host while `next dev` sees a local Host, and Next.js + // refuses a Server Action from an origin it is not told about. `next + // build` runs with NODE_ENV=production, so production keeps its + // same-origin check. + ...(process.env.NODE_ENV === "development" + ? { serverActions: { allowedOrigins: ["*.orun-preview.app", "preview-gateway-stage.oruncloud.workers.dev"] } } + : {}), + }, // Only a production build reads the wrangler config: `next dev` keeps the // template's own behaviour — `.env.local`, or its "connect Supabase" // steps when there is none.