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

Fix: x-forwarded-host is undefined on Netlify #54

Merged
merged 1 commit into from
Oct 15, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions lib/templates/netlifyFunction.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ exports.handler = (event, context, callback) => {
process.env.BINARY_SUPPORT = "yes";
}

// x-forwarded-host is undefined on Netlify for proxied apps that need it
// fixes https://github.com/netlify/next-on-netlify/issues/46
if (!event.multiValueHeaders.hasOwnProperty("x-forwarded-host")) {
event.multiValueHeaders["x-forwarded-host"] = [event.headers["host"]];
}

// Get the request URL
const { path } = event;
console.log("[request]", path);
Expand Down