diff --git a/lib/netlifyFunctionTemplate.js b/lib/netlifyFunctionTemplate.js index 15a7da8..e10c818 100644 --- a/lib/netlifyFunctionTemplate.js +++ b/lib/netlifyFunctionTemplate.js @@ -31,6 +31,12 @@ exports.handler = (event, context, callback) => { process.env.BINARY_SUPPORT = "yes"; } + // When running at the netlify, the header "host" is not set in + // multiValueHeaders. So we manually set this property. + if(!event.multiValueHeaders.hasOwnProperty('host')) { + event.multiValueHeaders['host'] = [event.headers['host']] + } + // Get the request URL const { path } = event; console.log("[request]", path);