From ea9b258be62bfff38fcb3bfb927be5b651d16957 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 20:49:15 +0000 Subject: [PATCH] The live preview keeps Server Actions (saas-parallel-baselining PB4) Behind orun.work's preview gateway 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 ("Invalid Server Actions request"). allowedDevOrigins does not cover that check. - apps/web/next.config.mjs: experimental.serverActions.allowedOrigins for the preview's hosts (*.orun-preview.app, preview-gateway-stage.oruncloud.workers.dev), only when NODE_ENV=development. `next build` runs with NODE_ENV=production, so the deployed site keeps its same-origin check. The site has no Server Action today; a coding session that adds one (a form) keeps a working preview. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_019PcpNV6SjymJBPv3nNkC4z --- apps/web/next.config.mjs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/apps/web/next.config.mjs b/apps/web/next.config.mjs index f241179..1996ed1 100644 --- a/apps/web/next.config.mjs +++ b/apps/web/next.config.mjs @@ -15,6 +15,16 @@ const 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"] } } + : {}), + }, }; export default nextConfig;