Skip to content
This repository was archived by the owner on May 10, 2021. It is now read-only.

Commit 246c53d

Browse files
Fix: x-forwarded-host is undefined on Netlify (#54)
1 parent 954c4a8 commit 246c53d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/templates/netlifyFunction.js

+6
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ exports.handler = (event, context, callback) => {
3131
process.env.BINARY_SUPPORT = "yes";
3232
}
3333

34+
// x-forwarded-host is undefined on Netlify for proxied apps that need it
35+
// fixes https://github.com/netlify/next-on-netlify/issues/46
36+
if (!event.multiValueHeaders.hasOwnProperty("x-forwarded-host")) {
37+
event.multiValueHeaders["x-forwarded-host"] = [event.headers["host"]];
38+
}
39+
3440
// Get the request URL
3541
const { path } = event;
3642
console.log("[request]", path);

0 commit comments

Comments
 (0)