Netlify does not send custom headers in a redirect file (using https in the "to")

Headers are only meant for static assets and not for redirects. What you’re intending to do, is easily achievable by using Edge Functions. It provides a context.rewrite() and context.cookie` API.