-
Notifications
You must be signed in to change notification settings - Fork 672
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: support both enable/disable attribute for multi value headers on ALB #392
feat: support both enable/disable attribute for multi value headers on ALB #392
Conversation
…n ALB Setting found in target groups of lambda type.
64e9b7f
to
9da7504
Compare
const multiValueHeaders = !event.headers ? getMultiValueHeaders({ headers: responseHeaders }) : undefined | ||
const headers = event.headers | ||
? Object.entries(responseHeaders).reduce((acc, [k, v]) => { | ||
acc[k] = Array.isArray(v) ? v[0] : v | ||
return acc | ||
}, {}) | ||
: undefined |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add some comments on what we're trying to do here? Why are we using event.headers
(request headers) for response headers?
Thanks for the PR. Could you add more context on why this is needed? Thanks! |
When multi header value setting is disabled in target group (the default, in an ALB config), we receive this kind of event :
When multi value headers setting is enabled, we have this kind of event
This patch accomodates both configurations dynamically. |
Was this ever implemented? I find that I must enable multi-value header option on ALB target group, or headers are not recognized at all in express server. At least, I know for sure that CORs does not work at all unless multi-value headers are enabled. |
# [4.5.0](v4.4.0...v4.5.0) (2021-10-13) ### Features * support both enable/disable attribute for multi value headers on ALB ([#392](#392)) ([a5cb5b5](a5cb5b5))
🎉 This PR is included in version 4.5.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
CodeGenieApp/serverless-express#392 makes the handler return headers in the field matching the one where it receives request headers: `headers` or `multiValueHeaders`. (I guess this is a preference for ALB?) Our mock server needs to be consistent in which one it looks at. This is a test-only change.
# [4.5.0](CodeGenieApp/serverless-express@v4.4.0...v4.5.0) (2021-10-13) ### Features * support both enable/disable attribute for multi value headers on ALB ([#392](CodeGenieApp/serverless-express#392)) ([a5cb5b5](CodeGenieApp/serverless-express@a5cb5b5))
Settings in lambda target group.
Issue #, if available:
Description of changes:
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.