Following the examples from the docs to do a 301 redirect, redirect is not preserving the path / url object not available

https://docs.layer0.co/guides/cookbook#section_redirecting_all_traffic_to_a_different_domain

Following this in a new app,

  .match({ headers: { host: /^(?!www\.)mydomain.com$/ } }, ({ redirect, send }) => {
    redirect(`https://www.mydomain.com/${url}`)
    send('', 301)
  })

The url object is not available in the router, the redirect has the following:
location: https://www.mydomain.com/undefined

Is there something I need to do to access the url in my router? My assumption is it would be global based on this

I think you want this instead:

redirect('https://www.mydomain.com/${url}')

Note the single quotes, not backticks. We’re not dereferencing url at runtime in serverless, but rather at the edge.

Yep, that was it. Thanks!