dougmoscrop/serverless-http

Elastic Load Balancer reverses order of `multiValueHeaders`

laverdet opened this issue · 0 comments

I noticed this issue and I'm not sure how long it's been around. I opened a similar issue at vendia/serverless-express#554 since we use both of these packages. AWS Elastic Load Balancer is reversing the order of header values specified in multiValueHeaders. Is this something that you've seen before?

exports.handler = async (event) => ({
  statusCode: 200,
  body: JSON.stringify(event),
  isBase64Encoded: false,
  cookies: [
    'a=1',
    'a=2',
  ],
  multiValueHeaders: {
    'x-set-cookie': [
      'a=1',
      'a=2'
    ],
  },
  'content-type': [ 'text/plain' ],
});
-> % curl -vv http://lambd-LoadB-1DYPW4EWVLYCT-1230052677.us-east-1.elb.amazonaws.com 2>&1 | grep -i set-cookie
< x-set-cookie: a=2
< x-set-cookie: a=1

We can workaround it obviously but I'm wondering if this is a new issue or if ELB has always been broken, or if it's only broken in certain circumstances.