We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e16868f commit 939055fCopy full SHA for 939055f
packages/cloudflare/src/cli/templates/init.ts
@@ -132,6 +132,14 @@ function populateProcessEnv(url: URL, env: CloudflareEnv) {
132
port: url.port,
133
},
134
});
135
+
136
+ /* We need to set this environment variable to make redirects work properly in preview mode.
137
+ * Next sets this in standalone mode during `startServer`. Without this the protocol would always be `https` here:
138
+ * https://github.com/vercel/next.js/blob/6b1e48080e896e0d44a05fe009cb79d2d3f91774/packages/next/src/server/app-render/action-handler.ts#L307-L316
139
+ */
140
+ if (url.hostname === "localhost") {
141
+ process.env.__NEXT_PRIVATE_ORIGIN = url.origin;
142
+ }
143
}
144
145
/* eslint-disable no-var */
0 commit comments