Open souenzzo opened 5 years ago
I dug into this and found that for servlets, Pedestal adds the header multiple times with each value, respectively. Additionally, the AWS API Gateway documentation supports passing multiple values for a header using the multiValueHeaders
key in responses. This ends up adding the header multiple times for each value as well.
I'll look into how multiValueHeaders can be supported but think that will involve a change to Datomic Ions web support.
See this for a slightly hacky workaround to this problem https://github.com/euccastro/expand-headers .
Can confirm @euccastro's workaround solves the issue when using API Gateway.
Some middlewares¹ create headers values like
{"Set-Cookie" ["foo"]}
On aws lambda, it results in
That throws:
Execution failed due to configuration error: Malformed Lambda proxy response
In aws docs², it shows in examples that headers should be a
(s/map-of string? string?)
In the case of cookies, it can be
(string/join ";" vs)
, but I dont know how "any many valued" header should be joined.I can find how jetty handle it :/
¹ https://github.com/ring-clojure/ring/blob/master/ring-core/src/ring/middleware/cookies.clj#L142 ² https://aws.amazon.com/premiumsupport/knowledge-center/malformed-502-api-gateway/