You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is problematic for any header that appears multiple times, for example, Set-Cookie and Cookie headers, which are often present multiple times in a response/request.
The lambda payload format singles cookies out for special treatment, putting them in their own top-level "cookies": [] field, not in "headers":{}.
I'm not sure, but I believe the solution is to encode Cookie headers specially for wai requests (pulling them from the lambda "cookies" field and adding them to Wai request headers), and to decode Set-Cookie headers specially for wai responses (filtering Set-Cookie headers from the Wai response and placing those into "cookies" for the lambda response object). At least this is what I'm doing in my wai-lambda fork, and it appears to do the right thing (cookies are set in the browser and accepted by the server for my lambda-hosted servant app).
The text was updated successfully, but these errors were encountered:
wai responses with multiple headers with the same key are not preserved when converting them to an Aeson object, because the list of
(HeaderName, HeaderValue)
pairs goes through a hashmap while generating the response object in API Gateway's preferred format: https://github.com/deckgo/wai-lambda/blob/master/src/Network/Wai/Handler/Lambda.hs#L334This is problematic for any header that appears multiple times, for example,
Set-Cookie
andCookie
headers, which are often present multiple times in a response/request.The lambda payload format singles cookies out for special treatment, putting them in their own top-level
"cookies": []
field, not in"headers":{}
.I'm not sure, but I believe the solution is to encode
Cookie
headers specially for wai requests (pulling them from the lambda"cookies"
field and adding them to Wai request headers), and to decodeSet-Cookie
headers specially for wai responses (filteringSet-Cookie
headers from the Wai response and placing those into"cookies"
for the lambda response object). At least this is what I'm doing in mywai-lambda
fork, and it appears to do the right thing (cookies are set in the browser and accepted by the server for my lambda-hosted servant app).The text was updated successfully, but these errors were encountered: