I’m trying to
[[redirects]]
from = "/api/:id/*"
to = "/.netlify/functions/:splat"
status = 200
headers = {X-Custom-Header = ":id"}
get the :id and turn that into a header and pass it to the functions. Even when I do
[[redirects]]
from = "/api/:id/*"
to = "/.netlify/functions/:splat"
status = 200
headers = {X-Netlify-Hostname = "host1.com"}
I do not get anything in the functions being called. I have
console.log(event)
inside the function. The output looks like
{ path: '/.netlify/functions/hello-world',
httpMethod: 'GET',
queryStringParameters: { name: 'John' },
headers:
{ 'x-forwarded-for': '::1',
'upgrade-insecure-requests': '1',
cookie: SOME_COOKIES
connection: 'close',
'accept-encoding': 'gzip, deflate',
'accept-language': 'en-GB,en;q=0.5',
accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:69.0) Gecko/20100101 Firefox/69.0',
host: 'localhost:8888',
'client-ip': '::1' },
body: '[object Object]',
isBase64Encoded: false }
As you can see the custom header is not in the header tag.