-
-
Notifications
You must be signed in to change notification settings - Fork 636
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
headers
and multiValueHeaders
are not set properly when using hono/aws-lambda
with ALB
#2626
Comments
@yusukebe I haven't seen this change. I'm going to test it and report back |
Yes I can confirm that it's still happening. It seems that ALB straight out ignores the headers if multiValueHeaders is present in the response |
Thank you for confirming. Can you create a PR to fix it? |
@yusukebe I will raise the PR soon. I was thinking of adding an albProcessor to seperate the ALB behavior from the API Gateway for the multiHeadersValue. Any thoughts? Or should I just put the the change in createResult and createRequest ? |
@yiss Thank you.
@watany-dev Do you have any advance? ^ |
This approach looks good.
|
What version of Hono are you using?
^4.3.2
What runtime/platform is your app running on?
Node, AWS Lambda
What steps can reproduce the bug?
When using
hono/aws-lambda
adapter with a Lambda that has an ALB in front of it. It shouldn't use themultiValueHeaders
as default, as this feature is not default when using ALB with Lambda target. Moreover, theset-cookie
behavior in the adapter might result in bugs in some cases.Example :
And CDK minimal config :
As I mentioned before the
multiValueHeaders
is not enabled by default, to enable it we must add the followingBut when this behavior is enabled, the ALB will ignore the
headers
value and only takemultiHeadersValue
except in Hono adapter not all the headers are propagated fromheaders
tomultiValueHeaders
. Disabling themultiValueHeaders
will result inset-cookie
being passed as an array so the ALB will only take the last valueHere is the result payload of the example with
multiValueHeaders
enabled :More info from AWS website : https://docs.aws.amazon.com/elasticloadbalancing/latest/application/lambda-functions.html#multi-value-headers
What is the expected behavior?
Two solution are possible :
set-cookie
is available, and it's an array, flatten it and put it directly in theevent.cookies
value as stringmultiValueHeaders
is present, pass to it all the values fromheaders
as wellWhat do you see instead?
No response
Additional information
I would love to contribute and create a PR for the fix. I have managed to create a wrapper around
handle
function for internal testing purposes.The text was updated successfully, but these errors were encountered: