8000 review · opennextjs/opennextjs-aws@68bb9b0 · GitHub
[go: up one dir, main page]

Skip to content

Commit 68bb9b0

Browse files
committed
review
1 parent 4925fb3 commit 68bb9b0

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

packages/open-next/src/overrides/converters/node.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,6 @@ const converter: Converter = {
3131
);
3232
const query = getQueryFromSearchParams(url.searchParams);
3333

34-
if (req.protocol === "http" && url.hostname === "localhost") {
35-
// This is used internally by Next.js during redirects in server actions. We need to set it to the origin of the request.
36-
process.env.__NEXT_PRIVATE_ORIGIN = url.origin;
37-
// This is to make `next-auth` and other libraries that rely on this header to work locally out of the box.
38-
headers["x-forwarded-proto"] = req.protocol;
39-
}
40-
4134
return {
4235
type: "core",
4336
method: req.method ?? "GET",

packages/open-next/src/overrides/wrappers/express-dev.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ const wrapper: WrapperHandler = async (handler, converter) => {
3434
});
3535

3636
app.all("*paths", async (req, res) => {
37+
if (req.protocol === "http" && req.hostname === "localhost") {
38+
// This is used internally by Next.js during redirects in server actions. We need to set it to the origin of the request.
39+
process.env.__NEXT_PRIVATE_ORIGIN = `${req.protocol}://${req.hostname}`;
40+
// This is to make `next-auth` and other libraries that rely on this header to work locally out of the box.
41+
req.headers["x-forwarded-proto"] = req.protocol;
42+
}
3743
const internalEvent = await converter.convertFrom(req);
3844
const streamCreator: StreamCreator = {
3945
writeHeaders: (prelude) => {

0 commit comments

Comments
 (0)
0